Commit graph

113572 commits

Author SHA1 Message Date
Wenzel Jakob 5e34b494a0
gh-60074: add new stable API function PyType_FromMetaclass (GH-93012)
Added a new stable API function ``PyType_FromMetaclass``, which mirrors
the behavior of ``PyType_FromModuleAndSpec`` except that it takes an
additional metaclass argument. This is, e.g., useful for language
binding tools that need to store additional information in the type
object.
2022-05-27 10:27:39 +02:00
Victor Stinner 20d30ba2cc
gh-92898: Enhance _testcppext test on cast to PyObject* (#93111)
* Add StrongRef class.
* Rename and reformat functions of the _Py_CAST() implementation.
2022-05-27 01:12:39 +02:00
Victor Stinner 5f8c3fb997
gh-91924: Optimize unicode_check_encoding_errors() (#93200)
Avoid _PyCodec_Lookup() and PyCodec_LookupError() for most common
built-in encodings and error handlers to avoid creating a temporary
Unicode string object, whereas these encodings and error handlers are
known to be valid.
2022-05-27 00:39:49 +02:00
Vinay Sajip efc5d37671
gh-91513: Tidied up a test and did minor refactoring around test filename gener… (GH-93265) 2022-05-26 17:11:15 +01:00
Éric da39719483
gh-93217: fix some issues in man page and --help (#93219) 2022-05-26 10:31:39 -04:00
Victor Stinner 06dd26f89f
test.pythoninfo logs more build info (#93225)
Log also test.support.check_sanitizer() values.
2022-05-26 16:07:01 +02:00
jackh-ncl cc377063ef
gh-91513: Add 'asyncio' taskName to logging LogRecord attributes. (GH-93193) 2022-05-26 09:30:51 +01:00
Victor Stinner 5185956527
gh-69443: Add test.support.Py_DEBUG constant (#93226) 2022-05-26 00:12:54 +02:00
Steve Dower ca58e4a2c5
gh-93005: Fix py.exe launcher test to search for intended tag (GH-93190) 2022-05-25 22:59:33 +01:00
Victor Stinner bf58cd01b3
gh-90817: Deprecate explicitly locale.resetlocale() (#93196)
The function was already deprecated in Python 3.11 since it calls
locale.getdefaultlocale() which was deprecated in Python 3.11.
2022-05-25 22:04:06 +02:00
oda-gitso 854db1a606
Remove unnecessary for loop initializer in long_lshift1() (GH-93071)
* Remove unnecessary for loop initialization.
2022-05-25 18:57:33 +01:00
oda-gitso 32e3b790bc
gh-93172: Remove unnecessary "if"s in binascii_a2b_qp_impl() from Modules/binascii.c (GH-93181) 2022-05-25 11:38:47 -04:00
Akuli a4974003ec
gh-93124: Fix typos in comments (GH-93125)
Fixes #93124

Automerge-Triggered-By: GH:rhettinger
2022-05-25 08:34:14 -07:00
Christian Heimes 1f134e96ba
gh-90473: Misc test fixes for WASI (GH-93218)
* ``sys.executable`` is not set
* WASI does not support subprocess
* ``pwd`` module is not available
* WASI checks ``open`` syscall flags more strict, needs r, w, rw flag.
* ``umask`` is not available
* ``/dev/null`` may not be accessible
2022-05-25 15:57:26 +02:00
Ken Jin 5e6e5b98a8
gh-92777: Add LOAD_METHOD_LAZY_DICT (GH-92778) 2022-05-25 14:06:15 +01:00
Erlend Egeberg Aasland db3ef0c82a
gh-93117: Remove too large sqlite3 bigmemtest (#93154) 2022-05-25 14:53:26 +02:00
Victor Stinner 71d8775fee
gh-93202: Always use %zd printf formatter (#93201)
Python now always use the ``%zu`` and ``%zd`` printf formats to
format a size_t or Py_ssize_t number. Building Python 3.12 requires a
C11 compiler, so these printf formats are now always supported.

* PyObject_Print() and _PyObject_Dump() now use the printf %zd format
  to display an object reference count.
* Update PY_FORMAT_SIZE_T comment.
* Remove outdated notes about the %zd format in PyBytes_FromFormat()
  and PyUnicode_FromFormat() documentations.
* configure no longer checks for the %zd format and no longer defines
  PY_FORMAT_SIZE_T macro in pyconfig.h.
* pymacconfig.h no longer undefines PY_FORMAT_SIZE_T: macOS 10.4 is
  no longer supported. Python 3.12 now requires macOS 10.6 (Snow
  Leopard) or newer.
2022-05-25 14:21:36 +02:00
oda-gitso 9485a0dbdd
gh-93040 Wrap unused parameters in Objects/obmalloc.c with Py_UNUSED (#93175) 2022-05-25 12:39:06 +02:00
Victor Stinner 5695c0e0a2
gh-91924: Fix __lltrace__ for non-UTF-8 stdout encoding (#93199)
Fix __lltrace__ debug feature if the stdout encoding is not UTF-8.

If the stdout encoding is not UTF-8, the first call to
lltrace_resume_frame() indirectly sets lltrace to 0 when calling
unicode_check_encoding_errors() which calls
encodings.search_function().
2022-05-25 11:45:33 +02:00
Florian Bruhin 19710145b4
test_threaded_import: Fix unittest.main spelling (GH-93114) 2022-05-25 10:59:32 +03:00
Miro Hrončok 16a7e4a0b7
gh-92728: Restore re.template, but deprecate it (GH-93161)
Revert "bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)"

This reverts commit b09184bf05.
2022-05-25 09:05:35 +03:00
Victor Stinner 08e4e887f2
gh-92658: AF_HYPERV is only supported on Windows (#93192)
Only build the AF_HYPERV support on Windows for the _socket extension.
FreeBSD defines the AF_HYPERV macro but doesn't have the SOCKADDR_HV
type.
2022-05-25 04:44:57 +02:00
neonene ac1dcb8ee7
gh-92434: Silence a compiler warning in _xxsubinterpretersmodule.c for 32bit version (gh-93091) 2022-05-25 10:22:39 +09:00
Tobin Yehle 08cfc3dabf
gh-93035: [Enum] Fix IntFlag crash when no single-bit members (GH-93076)
`EnumType` attempts to create a custom docstring for each enum/flag, but that was failing with pathological flags that had no members (only multi-bit aliases).
2022-05-24 18:16:20 -07:00
Victor Stinner 4a31ed8a32
test.pythoninfo no longer requires socket (#93191)
test.pythoninfo no longer fails if "import socket" fails: the socket
module is now optional.
2022-05-25 02:11:51 +02:00
Victor Stinner 32b7bcffba
gh-93103: Py_DecodeLocale() uses _PyRuntime.preconfig (#93187)
The Py_DecodeLocale() and Py_EncodeLocale() now use
_PyRuntime.preconfig, rather than Py_UTF8Mode and
Py_LegacyWindowsFSEncodingFlag global configuration varibles, to
decide if the UTF-8 encoding is used or not.

As documented, these functions must not be called before Python is
preinitialized. The new PyConfig API should now be used, rather than
using deprecated functions like Py_SetPath() or PySys_SetArgv().
2022-05-25 00:09:48 +02:00
Victor Stinner c7667a2d35
gh-93103: Enhance PyConfig.parser_debug documentation (#93186)
Document that -d option and PYTHONDEBUG env var require a debug
build of Python. Also mention them in the debug build documentation.
2022-05-24 23:23:01 +02:00
Jordan Borean fbd11f3edd
gh-92658: Add Hyper-V socket support (GH-92755) 2022-05-24 21:37:06 +01:00
Victor Stinner 5115a16831
gh-93103: Parser uses PyConfig.parser_debug instead of Py_DebugFlag (#93106)
* Replace deprecated Py_DebugFlag with PyConfig.parser_debug in the
  parser.
* Add Parser.debug member.
* Add tok_state.debug member.
* Py_FrozenMain(): Replace Py_VerboseFlag with PyConfig.verbose.
2022-05-24 22:35:08 +02:00
Kumar Aditya d2ef66a10b
GH-89369: test_contextlib_async finalizes event loop after each test (#93074)
Use asyncio.run().
2022-05-24 15:41:32 +02:00
Florian Bruhin 37c9a351b1
GH-93112: Fix missing ResourceDenied import in test_urllib2net (#93113)
The code was moved out of test.support in
311110abcd (GH-20812), thus making
ResourceDenied undefined.
2022-05-24 14:09:52 +02:00
goldsteinn 7108bdf27c
gh-93033: Use wmemchr in stringlib (GH-93034)
Generally comparable perf for the "good" case where memchr doesn't
return any collisions (false matches on lower byte) but clearly faster
with collisions.
2022-05-24 10:45:31 +09:00
Dong-hee Na f7fabae75c
gh-93099: Fix _pyio to use locale module properly (gh-93136) 2022-05-24 09:37:01 +09:00
Julien Palard e739ff1416
Doc: No need to use rst syntax in code comments. (GH-93102)
And it raises `make suspicious` false positives.
2022-05-23 23:45:16 +02:00
Nicolas Haller 2176898308
gh-92859: Doc: add info about logging.debug() calling basicConfig() (GH-93063) 2022-05-23 20:18:43 +01:00
Yury Selivanov c1f5c903a7
gh-93065: Fix HAMT to iterate correctly over 7-level deep trees (GH-93066)
Also while there, clarify a few things about why we reduce the hash to 32 bits.

Co-authored-by: Eli Libman <eli@hyro.ai>
Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-05-23 21:09:59 +02:00
Ethan Furman a49721ea07
gh-93118: [Enum] fix error message (GH-93138)
Include member names in error message.
2022-05-23 11:21:58 -07:00
Sam Ezeh 202ed2506c
gh-83245: Raise BadZipFile instead of ValueError when reading a corrupt ZIP file (GH-32291)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-23 20:59:21 +03:00
Steve Dower 6a6f823ea7
gh-92913: Fix typos in documentation (GH-93129) 2022-05-23 17:39:10 +01:00
oda-gitso 71abeb0895
gh-93010: InvalidHeaderError used but nonexistent (#93015)
* fix issue 93010

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2022-05-23 09:10:18 -07:00
Steve Dower 949dbf97ba
gh-93005: Fixes launcher test when no Python install is available (GH-93007) 2022-05-23 17:04:26 +01:00
Florian Bruhin d5f0dd1600
GH-93115: Fix version check in sqlite3 module constants test (#93116) 2022-05-23 17:58:11 +02:00
Ethan Furman 046df59658
gh93107: [Enum] fix missing variable in global_str (GH-93107) 2022-05-23 08:56:07 -07:00
Wenzel Jakob b2694ab469
gh-92536: Mark PyUnicode_READY() argument as unused (#93011) 2022-05-23 16:15:09 +02:00
Dennis Sweeney a458be3263
gh-93061: Mark as artificial: backwards jump after async for (GH-93062) 2022-05-23 13:58:41 +01:00
Victor Stinner fc00667247
gh-93103: Update PyUnicode_DecodeFSDefault() doc (#93105)
Update documentation of PyUnicode_DecodeFSDefault(),
PyUnicode_DecodeFSDefaultAndSize() and PyUnicode_EncodeFSDefault():
they now use the filesystem encoding and error handler of PyConfig,
Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors
variables are no longer used.
2022-05-23 14:56:59 +02:00
Victor Stinner 764e83db85
gh-93103: Deprecate global configuration variable (#93104)
Deprecate global configuration variables, like
Py_IgnoreEnvironmentFlag, in the documentation: the
Py_InitializeFromConfig() API should be instead.
2022-05-23 14:56:35 +02:00
Christian Heimes 760ec8940a
gh-90473: WASI: skip gethostname tests (GH-93092)
- WASI's ``gethostname()`` is a stub that always fails with OSError
  ``ENOTSUP``
- skip mailcap ``test`` if subprocess is not available
- WASI process_time clock does not work.
2022-05-23 10:39:57 +02:00
Nicolas Haller 88f0d0c1e8
gh-89158: Add some REPL secondary prompt markers (#93073)
This fixes an issue on tutorial/classes.rst section 9.4 where the example "class Warehouse"
was truncated when pressing the >>> button to hide the prompts and output.
2022-05-23 00:58:07 -04:00
Mori Bellamy 9bc616cb4c
gh-91061: also accept pathlib.Path for winsound.PlaySound (#91489)
Fixes #91061

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-22 18:54:24 -07:00