Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1f4b3bd

Browse filesBrowse files
authored
Merge pull request #13866 from anntzer/argparse
MNT: Switch PyArg_ParseTupleAndKeywords from "es" to "s".
2 parents 6a55cd9 + 3e83681 commit 1f4b3bd
Copy full SHA for 1f4b3bd

File tree

Expand file treeCollapse file tree

2 files changed

+8
-18
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-18
lines changed

‎src/_macosx.m

Copy file name to clipboardExpand all lines: src/_macosx.m
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -812,10 +812,10 @@ static CGFloat _get_device_scale(CGContextRef cr)
812812
FigureManager_set_window_title(FigureManager* self,
813813
PyObject *args, PyObject *kwds)
814814
{
815-
char* title;
816-
if(!PyArg_ParseTuple(args, "es", "UTF-8", &title))
815+
const char* title;
816+
if (!PyArg_ParseTuple(args, "s", &title)) {
817817
return NULL;
818-
818+
}
819819
Window* window = self->window;
820820
if(window)
821821
{
@@ -826,7 +826,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
826826
[window setTitle: ns_title];
827827
[pool release];
828828
}
829-
PyMem_Free(title);
830829
Py_RETURN_NONE;
831830
}
832831

@@ -1369,18 +1368,17 @@ -(void)save_figure:(id)sender
13691368
{
13701369
int result;
13711370
const char* title;
1372-
char* default_filename;
1373-
if(!PyArg_ParseTuple(args, "ses", &title, "UTF-8", &default_filename))
1371+
const char* default_filename;
1372+
if (!PyArg_ParseTuple(args, "ss", &title, &default_filename)) {
13741373
return NULL;
1375-
1374+
}
13761375
NSSavePanel* panel = [NSSavePanel savePanel];
13771376
[panel setTitle: [NSString stringWithCString: title
13781377
encoding: NSASCIIStringEncoding]];
13791378
NSString* ns_default_filename =
13801379
[[NSString alloc]
13811380
initWithCString: default_filename
13821381
encoding: NSUTF8StringEncoding];
1383-
PyMem_Free(default_filename);
13841382
#ifdef COMPILING_FOR_10_6
13851383
[panel setNameFieldStringValue: ns_default_filename];
13861384
result = [panel runModal];

‎src/ft2font_wrapper.cpp

Copy file name to clipboardExpand all lines: src/ft2font_wrapper.cpp
+2-10Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,15 +1066,10 @@ static PyObject *PyFT2Font_get_name_index(PyFT2Font *self, PyObject *args, PyObj
10661066
{
10671067
char *glyphname;
10681068
long name_index;
1069-
1070-
if (!PyArg_ParseTuple(args, "es:get_name_index", "ascii", &glyphname)) {
1069+
if (!PyArg_ParseTuple(args, "s:get_name_index", &glyphname)) {
10711070
return NULL;
10721071
}
1073-
10741072
CALL_CPP("get_name_index", name_index = self->x->get_name_index(glyphname));
1075-
1076-
PyMem_Free(glyphname);
1077-
10781073
return PyLong_FromLong(name_index);
10791074
}
10801075

@@ -1114,8 +1109,7 @@ const char *PyFT2Font_get_sfnt_table__doc__ =
11141109
static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObject *kwds)
11151110
{
11161111
char *tagname;
1117-
1118-
if (!PyArg_ParseTuple(args, "es:get_sfnt_table", "ascii", &tagname)) {
1112+
if (!PyArg_ParseTuple(args, "s:get_sfnt_table", &tagname)) {
11191113
return NULL;
11201114
}
11211115

@@ -1128,8 +1122,6 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj
11281122
}
11291123
}
11301124

1131-
PyMem_Free(tagname);
1132-
11331125
void *table = FT_Get_Sfnt_Table(self->x->get_face(), (FT_Sfnt_Tag)tag);
11341126
if (!table) {
11351127
Py_RETURN_NONE;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.