Skip to content

Commit c96c8c8

Browse files
StanFromIrelandmiss-islington
authored andcommitted
gh-155952: Fix <unrepresentable> Argument Clinic defaults in several signatures (GH-155954)
(cherry picked from commit 033dc43) Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent f71fbc5 commit c96c8c8

10 files changed

Lines changed: 20 additions & 17 deletions

File tree

Lib/test/test_inspect/test_inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6376,7 +6376,7 @@ def test_typing_module_has_signatures(self):
63766376
methods_unsupported_signature=methods_unsupported_signature)
63776377

63786378
def test_warnings_module_has_signatures(self):
6379-
unsupported_signature = {'warn', 'warn_explicit'}
6379+
unsupported_signature = {'warn_explicit'}
63806380
self._test_module_has_signatures(warnings, unsupported_signature=unsupported_signature)
63816381

63826382
def test_weakref_module_has_signatures(self):
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix the signatures of :meth:`sqlite3.Connection.execute`, :func:`warnings.warn`
2+
and :func:`locale.setlocale` which rendered ``<unrepresentable>`` instead of the
3+
correct defaults for parameters.

Modules/_localemodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@ check_locale_name_all(const char *locale)
126126
_locale.setlocale
127127
128128
category: int
129-
locale: str(accept={str, NoneType}) = NULL
129+
locale: str(accept={str, NoneType}) = None
130130
/
131131
132132
Activates/queries locale processing.
133133
[clinic start generated code]*/
134134

135135
static PyObject *
136136
_locale_setlocale_impl(PyObject *module, int category, const char *locale)
137-
/*[clinic end generated code: output=a0e777ae5d2ff117 input=dbe18f1d66c57a6a]*/
137+
/*[clinic end generated code: output=a0e777ae5d2ff117 input=b53449b63407179b]*/
138138
{
139139
char *result;
140140
PyObject *result_object;

Modules/_sqlite/clinic/connection.c.h

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

Modules/_sqlite/connection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ pysqlite_connection_call(PyObject *op, PyObject *args, PyObject *kwargs)
18721872
_sqlite3.Connection.execute as pysqlite_connection_execute
18731873
18741874
sql: unicode
1875-
parameters: object = NULL
1875+
parameters: object(c_default = 'NULL') = ()
18761876
/
18771877
18781878
Executes an SQL statement.
@@ -1881,7 +1881,7 @@ Executes an SQL statement.
18811881
static PyObject *
18821882
pysqlite_connection_execute_impl(pysqlite_Connection *self, PyObject *sql,
18831883
PyObject *parameters)
1884-
/*[clinic end generated code: output=5be05ae01ee17ee4 input=27aa7792681ddba2]*/
1884+
/*[clinic end generated code: output=5be05ae01ee17ee4 input=847390a17de45cc7]*/
18851885
{
18861886
PyObject* result = 0;
18871887

Modules/clinic/_localemodule.c.h

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

Objects/clinic/typevarobject.c.h

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

Objects/typevarobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,7 +2145,7 @@ typealias.__new__ as typealias_new
21452145
name: object(subclass_of="&PyUnicode_Type")
21462146
value: object
21472147
*
2148-
type_params: object = NULL
2148+
type_params: object(c_default="NULL") = ()
21492149
qualname: object(c_default="NULL") = None
21502150
21512151
Create a TypeAliasType.
@@ -2154,7 +2154,7 @@ Create a TypeAliasType.
21542154
static PyObject *
21552155
typealias_new_impl(PyTypeObject *type, PyObject *name, PyObject *value,
21562156
PyObject *type_params, PyObject *qualname)
2157-
/*[clinic end generated code: output=b7f6d9f1c577cd9c input=cbec290f8c4886ef]*/
2157+
/*[clinic end generated code: output=b7f6d9f1c577cd9c input=6516623275f87b5e]*/
21582158
{
21592159
if (type_params != NULL && !PyTuple_Check(type_params)) {
21602160
PyErr_SetString(PyExc_TypeError, "type_params must be a tuple");

Python/_warnings.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ warn as warnings_warn
11551155
source: object = None
11561156
If supplied, the destroyed object which emitted a ResourceWarning
11571157
*
1158-
skip_file_prefixes: object(type='PyTupleObject *', subclass_of='&PyTuple_Type') = NULL
1158+
skip_file_prefixes: object(type='PyTupleObject *', subclass_of='&PyTuple_Type', c_default='NULL') = ()
11591159
An optional tuple of module filename prefixes indicating frames to skip
11601160
during stacklevel computations for stack frame attribution.
11611161
@@ -1166,7 +1166,7 @@ static PyObject *
11661166
warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category,
11671167
Py_ssize_t stacklevel, PyObject *source,
11681168
PyTupleObject *skip_file_prefixes)
1169-
/*[clinic end generated code: output=a68e0f6906c65f80 input=eb37c6a18bec4ea1]*/
1169+
/*[clinic end generated code: output=a68e0f6906c65f80 input=2b52e8b20f508f51]*/
11701170
{
11711171
category = get_category(message, category);
11721172
if (category == NULL)

Python/clinic/_warnings.c.h

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

0 commit comments

Comments
 (0)