Skip to content

Commit 4db62e1

Browse files
bpo-35490: Remove the DecodeFSDefault return converter in AC. (#11152)
1 parent e2af34f commit 4db62e1

File tree

3 files changed

+10
-24
lines changed

3 files changed

+10
-24
lines changed

Modules/clinic/posixmodule.c.h

Lines changed: 3 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/posixmodule.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2647,7 +2647,7 @@ os_access_impl(PyObject *module, path_t *path, int mode, int dir_fd,
26472647

26482648
#ifdef HAVE_TTYNAME
26492649
/*[clinic input]
2650-
os.ttyname -> DecodeFSDefault
2650+
os.ttyname
26512651
26522652
fd: int
26532653
Integer file descriptor handle.
@@ -2657,16 +2657,17 @@ os.ttyname -> DecodeFSDefault
26572657
Return the name of the terminal device connected to 'fd'.
26582658
[clinic start generated code]*/
26592659

2660-
static char *
2660+
static PyObject *
26612661
os_ttyname_impl(PyObject *module, int fd)
2662-
/*[clinic end generated code: output=ed16ad216d813591 input=5f72ca83e76b3b45]*/
2662+
/*[clinic end generated code: output=c424d2e9d1cd636a input=9ff5a58b08115c55]*/
26632663
{
26642664
char *ret;
26652665

26662666
ret = ttyname(fd);
2667-
if (ret == NULL)
2668-
posix_error();
2669-
return ret;
2667+
if (ret == NULL) {
2668+
return posix_error();
2669+
}
2670+
return PyUnicode_DecodeFSDefault(ret);
26702671
}
26712672
#endif
26722673

Tools/clinic/clinic.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3166,16 +3166,6 @@ class float_return_converter(double_return_converter):
31663166
cast = '(double)'
31673167

31683168

3169-
class DecodeFSDefault_return_converter(CReturnConverter):
3170-
type = 'char *'
3171-
3172-
def render(self, function, data):
3173-
self.declare(data)
3174-
self.err_occurred_if_null_pointer("_return_value", data)
3175-
data.return_conversion.append(
3176-
'return_value = PyUnicode_DecodeFSDefault(_return_value);\n')
3177-
3178-
31793169
def eval_ast_expr(node, globals, *, filename='-'):
31803170
"""
31813171
Takes an ast.Expr node. Compiles and evaluates it.

0 commit comments

Comments
 (0)