[3.13] gh-155952: Fix `<unrepresentable>` Argument Clinic defaults in several signatures (#156170)

StanFromIreland <[email protected]>
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/45169108b781bc82dc00ff98cf305036fb2f9423
commit: 45169108b781bc82dc00ff98cf305036fb2f9423
branch: 3.13
author: stevens <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-08-21T13:25:13+01:00
summary:

[3.13] gh-155952: Fix `<unrepresentable>` Argument Clinic defaults in several signatures (#156170)

(cherry picked from commit 5a7fd421386d18b769e7a9f0c3a15b9f3690bff0)

Co-authored-by: Stan Ulbrych <[email protected]>

files:
A Misc/NEWS.d/next/Library/2026-08-17-12-40-00.gh-issue-155952.Vq3Lm8.rst
M Lib/test/test_inspect/test_inspect.py
M Modules/_localemodule.c
M Modules/_sqlite/clinic/connection.c.h
M Modules/_sqlite/connection.c
M Modules/clinic/_localemodule.c.h
M Objects/clinic/typevarobject.c.h
M Objects/typevarobject.c
M Python/_warnings.c
M Python/clinic/_warnings.c.h

diff --git a/Lib/test/test_inspect/test_inspect.py b/Lib/test/test_inspect/test_inspect.py
index 96b0f1870b0a20c..6ae9436293774d6 100644
--- a/Lib/test/test_inspect/test_inspect.py
+++ b/Lib/test/test_inspect/test_inspect.py
@@ -6377,7 +6377,7 @@ def test_typing_module_has_signatures(self):
                 methods_unsupported_signature=methods_unsupported_signature)
 
     def test_warnings_module_has_signatures(self):
-        unsupported_signature = {'warn', 'warn_explicit'}
+        unsupported_signature = {'warn_explicit'}
         self._test_module_has_signatures(warnings, unsupported_signature=unsupported_signature)
 
     def test_weakref_module_has_signatures(self):
diff --git a/Misc/NEWS.d/next/Library/2026-08-17-12-40-00.gh-issue-155952.Vq3Lm8.rst b/Misc/NEWS.d/next/Library/2026-08-17-12-40-00.gh-issue-155952.Vq3Lm8.rst
new file mode 100644
index 000000000000000..92b4a55692ee50a
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-08-17-12-40-00.gh-issue-155952.Vq3Lm8.rst
@@ -0,0 +1,3 @@
+Fix the signatures of :meth:`sqlite3.Connection.execute`, :func:`warnings.warn`
+and :func:`locale.setlocale` which rendered ``<unrepresentable>`` instead of the
+correct defaults for parameters.
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index a52e129da6f5c03..fcfc5c0bfca97b1 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -126,7 +126,7 @@ check_locale_name_all(const char *locale)
 _locale.setlocale
 
     category: int
-    locale: str(accept={str, NoneType}) = NULL
+    locale: str(accept={str, NoneType}) = None
     /
 
 Activates/queries locale processing.
@@ -134,7 +134,7 @@ Activates/queries locale processing.
 
 static PyObject *
 _locale_setlocale_impl(PyObject *module, int category, const char *locale)
-/*[clinic end generated code: output=a0e777ae5d2ff117 input=dbe18f1d66c57a6a]*/
+/*[clinic end generated code: output=a0e777ae5d2ff117 input=b53449b63407179b]*/
 {
     char *result;
     PyObject *result_object;
diff --git a/Modules/_sqlite/clinic/connection.c.h b/Modules/_sqlite/clinic/connection.c.h
index 4eede407f9af1d5..925d89e059d4ba5 100644
--- a/Modules/_sqlite/clinic/connection.c.h
+++ b/Modules/_sqlite/clinic/connection.c.h
@@ -1104,7 +1104,7 @@ pysqlite_connection_load_extension(pysqlite_Connection *self, PyObject *const *a
 #endif /* defined(PY_SQLITE_ENABLE_LOAD_EXTENSION) */
 
 PyDoc_STRVAR(pysqlite_connection_execute__doc__,
-"execute($self, sql, parameters=<unrepresentable>, /)\n"
+"execute($self, sql, parameters=(), /)\n"
 "--\n"
 "\n"
 "Executes an SQL statement.");
@@ -1869,4 +1869,4 @@ getconfig(pysqlite_Connection *self, PyObject *arg)
 #ifndef DESERIALIZE_METHODDEF
     #define DESERIALIZE_METHODDEF
 #endif /* !defined(DESERIALIZE_METHODDEF) */
-/*[clinic end generated code: output=5e0bcef289eb64cc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=cf9db567ce9cdd0d input=a9049054013a1b77]*/
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 9e9c6393bf56a10..10136af6c0bb963 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -1891,7 +1891,7 @@ pysqlite_connection_call(pysqlite_Connection *self, PyObject *args,
 _sqlite3.Connection.execute as pysqlite_connection_execute
 
     sql: unicode
-    parameters: object = NULL
+    parameters: object(c_default = 'NULL') = ()
     /
 
 Executes an SQL statement.
@@ -1900,7 +1900,7 @@ Executes an SQL statement.
 static PyObject *
 pysqlite_connection_execute_impl(pysqlite_Connection *self, PyObject *sql,
                                  PyObject *parameters)
-/*[clinic end generated code: output=5be05ae01ee17ee4 input=27aa7792681ddba2]*/
+/*[clinic end generated code: output=5be05ae01ee17ee4 input=847390a17de45cc7]*/
 {
     PyObject* result = 0;
 
diff --git a/Modules/clinic/_localemodule.c.h b/Modules/clinic/_localemodule.c.h
index 5e0880b0d0bb4c0..118946b81474ea1 100644
--- a/Modules/clinic/_localemodule.c.h
+++ b/Modules/clinic/_localemodule.c.h
@@ -5,7 +5,7 @@ preserve
 #include "pycore_modsupport.h"    // _PyArg_CheckPositional()
 
 PyDoc_STRVAR(_locale_setlocale__doc__,
-"setlocale($module, category, locale=<unrepresentable>, /)\n"
+"setlocale($module, category, locale=None, /)\n"
 "--\n"
 "\n"
 "Activates/queries locale processing.");
@@ -595,4 +595,4 @@ _locale_getencoding(PyObject *module, PyObject *Py_UNUSED(ignored))
 #ifndef _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF
     #define _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF
 #endif /* !defined(_LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF) */
-/*[clinic end generated code: output=034a3c219466d207 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=bb987603f9de8824 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/typevarobject.c.h b/Objects/clinic/typevarobject.c.h
index 0ba4ff48bc88044..f1e837f3fa572a3 100644
--- a/Objects/clinic/typevarobject.c.h
+++ b/Objects/clinic/typevarobject.c.h
@@ -629,7 +629,7 @@ typealias_reduce(typealiasobject *self, PyObject *Py_UNUSED(ignored))
 }
 
 PyDoc_STRVAR(typealias_new__doc__,
-"typealias(name, value, *, type_params=<unrepresentable>)\n"
+"typealias(name, value, *, type_params=())\n"
 "--\n"
 "\n"
 "Create a TypeAliasType.");
@@ -695,4 +695,4 @@ typealias_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=73b39e550e4e336c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ce8cb5d115356132 input=a9049054013a1b77]*/
diff --git a/Objects/typevarobject.c b/Objects/typevarobject.c
index 239911ab528a894..7f50e960453ac36 100644
--- a/Objects/typevarobject.c
+++ b/Objects/typevarobject.c
@@ -1715,7 +1715,7 @@ typealias.__new__ as typealias_new
     name: object(subclass_of="&PyUnicode_Type")
     value: object
     *
-    type_params: object = NULL
+    type_params: object(c_default="NULL") = ()
 
 Create a TypeAliasType.
 [clinic start generated code]*/
@@ -1723,7 +1723,7 @@ Create a TypeAliasType.
 static PyObject *
 typealias_new_impl(PyTypeObject *type, PyObject *name, PyObject *value,
                    PyObject *type_params)
-/*[clinic end generated code: output=8920ce6bdff86f00 input=df163c34e17e1a35]*/
+/*[clinic end generated code: output=8920ce6bdff86f00 input=8838986b41cae743]*/
 {
     if (type_params != NULL && !PyTuple_Check(type_params)) {
         PyErr_SetString(PyExc_TypeError, "type_params must be a tuple");
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 395eae190edfe2c..f348b315ba257d5 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -1023,7 +1023,7 @@ warn as warnings_warn
     source: object = None
       If supplied, the destroyed object which emitted a ResourceWarning
     *
-    skip_file_prefixes: object(type='PyTupleObject *', subclass_of='&PyTuple_Type') = NULL
+    skip_file_prefixes: object(type='PyTupleObject *', subclass_of='&PyTuple_Type', c_default='NULL') = ()
       An optional tuple of module filename prefixes indicating frames to skip
       during stacklevel computations for stack frame attribution.
 
@@ -1034,7 +1034,7 @@ static PyObject *
 warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category,
                    Py_ssize_t stacklevel, PyObject *source,
                    PyTupleObject *skip_file_prefixes)
-/*[clinic end generated code: output=a68e0f6906c65f80 input=eb37c6a18bec4ea1]*/
+/*[clinic end generated code: output=a68e0f6906c65f80 input=2b52e8b20f508f51]*/
 {
     category = get_category(message, category);
     if (category == NULL)
diff --git a/Python/clinic/_warnings.c.h b/Python/clinic/_warnings.c.h
index 98dc49db3059b16..5745a8ec237d3bb 100644
--- a/Python/clinic/_warnings.c.h
+++ b/Python/clinic/_warnings.c.h
@@ -11,7 +11,7 @@ preserve
 
 PyDoc_STRVAR(warnings_warn__doc__,
 "warn($module, /, message, category=None, stacklevel=1, source=None, *,\n"
-"     skip_file_prefixes=<unrepresentable>)\n"
+"     skip_file_prefixes=())\n"
 "--\n"
 "\n"
 "Issue a warning, or maybe ignore it or raise an exception.\n"
@@ -244,4 +244,4 @@ warnings_filters_mutated(PyObject *module, PyObject *Py_UNUSED(ignored))
 {
     return warnings_filters_mutated_impl(module);
 }
-/*[clinic end generated code: output=f2d4214c382717a6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=0e02494c9d18b918 input=a9049054013a1b77]*/

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.