Commit Graph

1657 Commits

Author SHA1 Message Date
Christian Heimes 0d35a59ce3
gh-95174: Handle missing dup() and constants in WASI (GH-95229)
- check for ``dup()`` libc function
- handle missing ``F_DUPFD`` in ``dup2()`` replacement function
- add workaround for WASI libc bug in MSG_TRUNC
- ESHUTDOWN is missing, use EPIPE instead
- POLLPRI is missing, define as 0 (no-op)
2022-07-26 11:16:51 +02:00
Steve Dower 4b4439daed
gh-90844: Allow virtual environments to correctly launch when they have spaces in the path (GH-94903) 2022-07-16 17:38:36 +01:00
Paul Moore 407ff6556c
gh-94772: Fix off-by-one error in Windows launcher (GH-94779) 2022-07-16 10:02:22 +01:00
Oleg Iarygin 9b50f76fcd
gh-94512: Fix forced arg format in AC-processed winreg (GH-94513) 2022-07-04 14:10:10 +01:00
Oleg Iarygin 21f6b4d783
gh-94512: Fix forced arg format in AC-processed msvcrtmodule (GH-94514) 2022-07-04 14:09:34 +01:00
Oleg Iarygin 9ef50c1d46
Delete DOS-only PC/testpy.py (GH-94419) 2022-06-30 14:17:35 +01:00
Oleg Iarygin 63c772d5ae
Delete unused PC/empty.c (GH-94418) 2022-06-29 15:58:56 +01:00
Victor Stinner 47e35625ff
gh-84623: Remove unused imports (#94132) 2022-06-22 19:14:27 +02:00
Christian Heimes 3124d9a5aa
gh-93491: Add support tier detection to configure (GH-93492)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-06-10 15:25:33 +02:00
Kumar Aditya cb04a09d2d
GH-93207: Remove HAVE_STDARG_PROTOTYPES configure check for stdarg.h (#93215) 2022-05-27 13:30:45 +02:00
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
Steve Dower 949dbf97ba
gh-93005: Fixes launcher test when no Python install is available (GH-93007) 2022-05-23 17:04:26 +01: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
Steve Dower 73473fdeac
gh-92817: Fix precedence of options to py.exe launcher (GH-92988) 2022-05-19 23:45:41 +01:00
Inada Naoki f9c9354a7a
gh-92536: PEP 623: Remove wstr and legacy APIs from Unicode (GH-92537) 2022-05-12 14:48:38 +09:00
CAM Gerlach f1bbcba74f
gh-76773: Update docs mentioning no-longer-supported Windows versions & features (GH-92529) 2022-05-10 09:30:32 +03:00
Dong-hee Na d284e8b3e3
Update CPyhton configuration for 3.12 (#92451)
* Update CPyhton configuration for 3.12

* Fix PC/pyconfig.h

* Add expect failure
2022-05-08 13:44:12 +01:00
Victor Stinner b270b82f11
gh-91320: Argument Clinic uses _PyCFunction_CAST() (#32210)
Replace "(PyCFunction)(void(*)(void))func" cast with
_PyCFunction_CAST(func).
2022-05-03 20:25:41 +02:00
Ganesh Kathiresan d414f7ece8
gh-90822: Make `PY_SSIZE_T_MAX` and `PY_SSIZE_T_MIN` constant expression (GH-92071) 2022-05-02 17:23:28 +09:00
Petr Viktorin 6dcbc08c95
gh-91324: List feature macros in the stable ABI manifest, improve tests (GH-32415) 2022-04-28 16:30:28 +02:00
Petr Viktorin ac4ffd3be2
bpo-47169: Export PyOS_CheckStack on Windows (GH-32414) 2022-04-21 18:03:25 +02:00
Barry Warsaw 7173fd5de0
Remove the ancient Pynche color editor (#91554)
Closes #91551
2022-04-17 15:38:44 -07:00
Irit Katriel 5d421d7342
gh-90501: Add PyErr_GetHandledException and PyErr_SetHandledException (GH-30531) 2022-04-15 19:57:47 +01:00
Steve Dower 2390b2236d
bpo-47239: Fixes py.exe output when run in a virtual environment. (GH-32364) 2022-04-07 00:09:54 +01:00
Steve Dower bad86a621a
bpo-46566: Add new py.exe launcher implementation (GH-32062) 2022-03-29 00:21:08 +01:00
Steve Dower 3751b6b030
bpo-47086: Remove .chm from Windows installer and add HTML docs (GH-32038) 2022-03-22 01:08:37 +00:00
Victor Stinner 4657bf7016
bpo-1635741: Fix winreg reference leaks (GH-31560)
Clear also the PyHKEY_Type static type at exit.
2022-02-25 12:34:00 +01:00
Steve Dower 3a5afc14e1
bpo-46638: Makes registry virtualisation setting stable when building MSIX packages (GH-31130) 2022-02-07 16:59:40 +00:00
Steve Dower 9b4e3d94a5
bpo-46629: Update classicAppCompat.sccd for new signing certificate (GH-31111) 2022-02-04 16:11:19 +00:00
Manish Kumar ⛄ ba650af7d6
Optimize images by IMGbot (GH-21348)
Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
2022-02-04 15:49:43 +09:00
Oleg Iarygin 38e0b9efdf
bpo-37705: Remove orphaned PC/errmap.mak (GH-29724)
After GH-15623 deleted `generrmap.c`, a related mak-file stopped working. The mak contains generrmap-related rules only so it should be removed altogether.

Further search for `errmap\.mak|generrmap` regex through content of CPython files shows no dangling reference left.

Since generrmap is already effectively removed, this pull request contains no blurp.
2022-02-02 08:23:30 -08:00
Christian Heimes f66c857572
bpo-45459: Add Py_buffer to limited API (GH-29991)
- [x] ``Py_buffer`` struct
- [x] ``PyBuffer_*()`` API functions
- [x] ``PyBUF_*`` constants
- [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots
- [x] ``PyMemoryView_FromBuffer()`` API
- [x] tests for limited API
- [x] ``make regen-limited-abi``
- [x] documentation update
- [ ] export ``PyPickleBuffer*()`` API ???
2022-02-02 07:03:10 -08:00
Christian Heimes a6ca8eee22
bpo-46315: Add ifdef HAVE_ feature checks for WASI compatibility (GH-30507) 2022-01-13 09:46:04 +01:00
Victor Stinner 08bc1bad11
bpo-46303: Fix fileutils.h compiler warnings (GH-30550)
Add missing pycore_fileutils.h include in _tkinter.c and
_testconsole.c.
2022-01-12 00:35:26 +01:00
Mark Shannon e028ae99ec
bpo-45923: Handle call events in bytecode (GH-30364)
* Add a RESUME instruction to handle "call" events.
2022-01-06 13:09:25 +00:00
Benjamin Peterson ba00f0d93a
Update copyright year to 2022. (GH-30335)
Automerge-Triggered-By: GH:benjaminp
2022-01-02 12:08:48 -08:00
Gabriele N. Tornetta 50669083fe
bpo-43931: Export Python version as API data (GH-25577)
When Python is embedded in other applications, it is not easy to determine which version of Python is being used. This change exposes the Python version as part of the API data. Tools like Austin (https://github.com/P403n1x87/austin) can benefit from this data when targeting applications like uWSGI, as the Python version can then be inferred systematically by looking at the exported symbols rather than relying on unreliable pattern matching or other hacks (like remote code execution etc...).

Automerge-Triggered-By: GH:pablogsal
2021-12-09 17:52:05 -08:00
Mark Shannon 8319114fee
bpo-45947: Place dict and values pointer at fixed (negative) offset just before GC header. (GH-29879)
* Place __dict__ immediately before GC header for plain Python objects.

* Fix up lazy dict creation logic to use managed dict pointers.

* Manage values pointer, placing them directly before managed dict pointers.

* Convert hint-based load/store attr specialization target managed dict classes.

* Specialize LOAD_METHOD for managed dict objects.

* Remove unsafe _PyObject_GC_Calloc function.

* Remove unsafe _PyObject_GC_Malloc() function.

* Add comment explaning use of Py_TPFLAGS_MANAGED_DICT.
2021-12-07 16:02:53 +00:00
Steve Dower 99fcf15052
bpo-45582: Port getpath[p].c to Python (GH-29041)
The getpath.py file is frozen at build time and executed as code over a namespace. It is never imported, nor is it meant to be importable or reusable. However, it should be easier to read, modify, and patch than the previous code.

This commit attempts to preserve every previously tested quirk, but these may be changed in the future to better align platforms.
2021-12-03 00:08:42 +00:00
Vinay Sajip 4141d94fa6
bpo-44391: Remove unused argument from a varargs call. (GH-29843) 2021-11-29 17:26:50 +00:00
Steve Dower 4841e694ee
bpo-45901: Fixes argument passing when invoking .py files directly through the Store package (GH-29799) 2021-11-26 23:08:20 +00:00
Christian Heimes 8caceb7a47
bpo-40280: Add configure check for socket shutdown (GH-29795) 2021-11-26 15:16:54 +01:00
Zachary Ware f9de97aae5
bpo-45616: Let py.exe distinguish between v3.1 and v3.10 (GH-29731) 2021-11-23 22:41:04 -06:00
Steve Dower a56fbad85e
bpo-45220: Ensure RT_MANIFEST is defined when compiling Windows resource files (GH-29501) 2021-11-09 20:12:53 +00:00
Steve Dower a4774f42e3
bpo-45720: Drop references to shlwapi.dll on Windows (GH-29417) 2021-11-05 23:06:45 +00:00
Steve Dower fd0c84dc28
bpo-45220: Remove invalid include from resource definition files on Windows (GH-29396) 2021-11-04 16:39:36 +00:00
Irit Katriel f30ad65dbf
bpo-45292: [PEP 654] add the ExceptionGroup and BaseExceptionGroup classes (GH-28569) 2021-10-23 00:13:46 +01:00
Christian Heimes 9942f42a93
bpo-45522: Allow to disable freelists on build time (GH-29056)
Freelists for object structs can now be disabled. A new ``configure``
option ``--without-freelists`` can be used to disable all freelists
except empty tuple singleton. Internal Py*_MAXFREELIST macros can now
be defined as 0 without causing compiler warnings and segfaults.

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-21 06:12:20 -07:00
Ken Jin 2cbf50e812
bpo-44220: Export PyStructSequence_UnnamedField in the limited API (GH-26331) 2021-10-21 10:46:48 +02:00
Victor Stinner 00ffc4513d
bpo-45440: Remove pymath.c fallbacks (GH-28977)
Remove fallbacks for missing round(), copysign() and hypot() in
Python/pymath.c. Python now requires these functions to build.

These fallbacks were needed on Visual Studio 2012 and older. They are
no longer needed since Visual Stuido 2013. Python is now built with
Visual Studio 2017 or newer since Python 3.6.
2021-10-15 19:45:34 +02:00
Victor Stinner 194a9526d8
bpo-45440: Require math.h isinf() to build (GH-28894)
Building Python now requires a C99 <math.h> header file providing
isinf(), isnan() and isfinite() functions.

Remove the Py_FORCE_DOUBLE() macro. It was used by the
Py_IS_INFINITY() macro.

Changes:

* Remove Py_IS_NAN(), Py_IS_INFINITY() and Py_IS_FINITE()
  in PC/pyconfig.h.
* Remove the _Py_force_double() function.
* configure no longer checks if math.h defines isinf(), isnan() and
  isfinite().
2021-10-13 23:27:50 +02:00
Victor Stinner aac29af678
bpo-45434: pyport.h no longer includes <stdlib.h> (GH-28914)
Include <stdlib.h> explicitly in C files.

Python.h includes <wchar.h>.
2021-10-13 19:25:53 +02:00
Victor Stinner 97308dfcdc
bpo-45434: Move _Py_BEGIN_SUPPRESS_IPH to pycore_fileutils.h (GH-28922) 2021-10-13 15:03:35 +02:00
Christian Clauss 5f401f1040
Fix typos in the Objects directory (GH-28766) 2021-10-06 16:57:10 -07:00
Steve Dower 6c942a86a4
bpo-45375: Fix off by one error in buffer allocation (GH-28764) 2021-10-06 20:09:33 +01:00
Steve Dower 5146877623
bpo-45375: Fix assertion failure due to searching for stdlib in unnormalised paths (GH-28735) 2021-10-05 13:37:43 +01:00
Eric Snow 0c50b8c0b8
bpo-45211: Remember the stdlib dir during startup. (gh-28586)
During runtime startup we figure out the stdlib dir but currently throw that information away. This change preserves it and exposes it via PyConfig.stdlib_dir, _Py_GetStdlibDir(), and sys._stdlib_dir.

https://bugs.python.org/issue45211
2021-09-28 12:18:28 -06:00
Eric Snow ae7839bbe8
bpo-45211: Move helpers from getpath.c to internal API. (gh-28550)
This accomplishes 2 things:

* consolidates some common code between getpath.c and getpathp.c
* makes the helpers available to code in other files

FWIW, the signature of the join_relfile() function (in fileutils.c) intentionally mirrors that of Windows' PathCchCombineEx().

Note that this change is mostly moving code around. No behavior is meant to change.

https://bugs.python.org/issue45211
2021-09-27 10:00:32 -06:00
Mohamad Mansour 8f943ca257
[codemod] Fix non-matching bracket pairs (GH-28473)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-09-22 01:09:00 +02:00
Steve Dower 09b4ad11f3
bpo-45188: Windows now regenerates frozen modules at the start of build instead of late (GH-28322)
This will enable us to drop the frozen module header files from the repository.

It does currently cause many source files to be built twice, which just takes more time. For whoever comes to fix this in the future, the files shared between freeze_module and pythoncore should be put into a static library that is consumed by both.
2021-09-15 18:11:12 +01:00
Yury Selivanov 2c3474a637
bpo-45123: PyAiter_Check and PyObject_GetAiter fix & rename. (GH-28194)
Fix PyAiter_Check to only check for the `__anext__` presense (not for
`__aiter__`). Rename `PyAiter_Check()` to `PyAIter_Check()`,
`PyObject_GetAiter()` -> `PyObject_GetAIter()`.

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-09-07 11:52:30 +01:00
Pablo Galindo Salgado a24676bedc
Add tests for the C tokenizer and expose it as a private module (GH-27924) 2021-08-24 17:50:05 +01:00
Hai Shi 3e2c643ae0
bpo-42035: Add PyType_GetQualName() to get a type's qualified name. (GH-27551) 2021-08-17 15:39:34 +02:00
Inada Naoki ce5e1a6809
bpo-41103: Resurrect the old buffer protocol. (GH-27437)
Revert "bpo-41103: Remove old buffer protocol support (#21117)"

This reverts commit 6f8a6ee59c.
2021-07-29 12:46:47 +02:00
Hai Shi a390ebea17
bpo-42035: Add a PyType_GetName() to get type's short name. (GH-23903) 2021-07-29 09:57:02 +02:00
Mariusz Felisiak 11749e2dc2
bpo-44740: Lowercase "internet" and "web" where appropriate. (#27378)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-27 00:11:55 +02:00
Yurii Karabas 96c4cbd96c
bpo-44353: Implement typing.NewType __call__ method in C (#27262)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Denis Laxalde <denis@laxalde.org>
2021-07-22 23:06:54 +02:00
Victor Stinner db532a0999
bpo-39947: Remove old private trashcan C API functions (GH-26869)
Remove 4 C API private trashcan functions which were only kept for
the backward compatibility of the stable ABI with Python 3.8 and
older, since the trashcan API was not usable with the limited C API
on Python 3.8 and older. The trashcan API was excluded from the
limited C API in Python 3.9.

Removed functions:

* _PyTrash_deposit_object()
* _PyTrash_destroy_chain()
* _PyTrash_thread_deposit_object()
* _PyTrash_thread_destroy_chain()

The trashcan C API was never usable with the limited C API, since old
trashcan macros accessed directly PyThreadState members like
"_tstate->trash_delete_nesting", whereas the PyThreadState structure
is opaque in the limited C API.

Exclude also the PyTrash_UNWIND_LEVEL constant from the C API.

The trashcan C API was modified in Python 3.9 by commit
38965ec541 and in Python 3.10 by commit
ed1a5a5bac to hide implementation
details.
2021-06-23 15:51:47 +02:00
Ken Jin 6773c3eaa7
bpo-44392: Add Py_GenericAlias to C API docs (GH-26724)
Also fix stable ABI type definitions
2021-06-16 07:12:25 -07:00
Petr Viktorin d16856960e
bpo-43795: Remove Py_FrozenMain from the Limited API & Stable ABI (GH-26241)
Py_FrozenMain was added to the Limited C API in [bpo-42591]() (3.10.0a4);
but to fix that issue it would be enough to add it to the regular C API.

The function is undocumented, tests were added very recently ([bpo-44131]()),
and most importantly, it is not present in all builds of Python, as
the linker sometimes omits it as unused.
It should be added back when these issues are fixed.

Note that this does not affect Python's regular C API.
2021-05-25 04:42:03 -07:00
Mark Shannon adcd220556
bpo-40222: "Zero cost" exception handling (GH-25729)
"Zero cost" exception handling.

* Uses a lookup table to determine how to handle exceptions.
* Removes SETUP_FINALLY and POP_TOP block instructions, eliminating (most of) the runtime overhead of try statements.
* Reduces the size of the frame object by about 60%.
2021-05-07 15:19:19 +01:00
Petr Viktorin cf86996a8e
bpo-43795: Mark PyCodec_Unregister as a function, not data, in stable ABI (GH-25920) 2021-05-05 19:32:21 +02:00
Pablo Galindo 2fc857a572
Update CI files to account for the master -> main rename (GH-25860) 2021-05-03 23:36:55 +01:00
Pablo Galindo c2931d31f8
bpo-43916: Move the _PyStructSequence_InitType function to the internal API (GH-25854) 2021-05-03 15:50:24 +01:00
Pablo Galindo 558df90109
bpo-43916: Export the _PyStructSequence_InitType to fix build errors in the curses module (GH-25768) 2021-05-01 02:21:19 +01:00
Petr Viktorin 14fc2bdfab
bpo-28254: Add PyGC_ functions to the stable ABI manifest (GH-25720)
Co-authored-by: Senthil Kumaran <senthil@uthcode.com>
Co-authored-by: scoder <stefan_ml@behnel.de>
2021-04-29 15:46:48 +02:00
Petr Viktorin f6ee4dad58
bpo-43795: Generate python3dll.c and doc data from manifest (PEP 652) (GH-25315) 2021-04-29 11:33:14 +02:00
Segev Finer 5e437fb872
bpo-30555: Fix WindowsConsoleIO fails in the presence of fd redirection (GH-1927)
This works by not caching the handle and instead getting the handle from
the file descriptor each time, so that if the actual handle changes by
fd redirection closing/opening the console handle beneath our feet, we
will keep working correctly.
2021-04-23 23:00:27 +01:00
Petr Viktorin 91b69b77cf
bpo-43868: Remove PyOS_ReadlineFunctionPointer from the stable ABI list (GH-25442)
The inclusion of PyOS_ReadlineFunctionPointer in python3dll.c was a mistake.

According to PEP 384:
> functions expecting FILE* are not part of the ABI, to avoid depending
> on a specific version of the Microsoft C runtime DLL on Windows.

https://bugs.python.org/issue43868
2021-04-23 14:23:38 +02:00
Petr Viktorin 92eebf6dd2
bpo-43795: Sort PC/python3dll.c (GH-25312)
Each section is sorted to reduce diffs (review effort) when the file becomes generated.
Sort is done with key=str.lower to preserve most of the original order (underscored items first).

https://bugs.python.org/issue43795
2021-04-14 16:38:30 +02:00
Victor Stinner 3359cab038
bpo-43688: Support the limited C API in debug mode (GH-25131)
The limited C API is now supported if Python is built in debug mode
(if the Py_DEBUG macro is defined). In the limited C API, the
Py_INCREF() and Py_DECREF() functions are now implemented as opaque
function calls, rather than accessing directly the PyObject.ob_refcnt
member, if Python is built in debug mode and the Py_LIMITED_API macro
targets Python 3.10 or newer. It became possible to support the
limited C API in debug mode because the PyObject structure is the
same in release and debug mode since Python 3.8 (see bpo-36465).

The limited C API is still not supported in the --with-trace-refs
special build (Py_TRACE_REFS macro).
2021-04-02 15:45:37 +02:00
Jessica Clarke dec0757549
bpo-43179: Generalise alignment for optimised string routines (GH-24624)
* Remove m68k-specific hack from ascii_decode

On m68k, alignments of primitives is more relaxed, with 4-byte and
8-byte types only requiring 2-byte alignment, thus using sizeof(size_t)
does not work. Instead, use the portable alternative.

Note that this is a minimal fix that only relaxes the assertion and the
condition for when to use the optimised version remains overly strict.
Such issues will be fixed tree-wide in the next commit.

NB: In C11 we could use _Alignof(size_t) instead, but for compatibility
we use autoconf.

* Optimise string routines for architectures with non-natural alignment

C only requires that sizeof(x) is a multiple of alignof(x), not that the
two are equal. Thus anywhere where we optimise based on alignment we
should be using alignof(x) not sizeof(x).

This is more annoying than it would be in C11 where we could just use
_Alignof(x) (and alignof(x) in C++11), but since we still require only
C99 we must plumb the information all the way from autoconf through the
various typedefs and defines.
2021-03-31 12:12:39 +02:00
Zackery Spytz dfeec347f2
bpo-43637: Fix a possible memory leak in winreg.SetValueEx() (GH-25038) 2021-03-30 15:22:34 +09:00
Inada Naoki 4827483f47
bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)
See [PEP 597](https://www.python.org/dev/peps/pep-0597/).

* Add `-X warn_default_encoding` and `PYTHONWARNDEFAULTENCODING`.
* Add EncodingWarning
* Add io.text_encoding()
* open(), TextIOWrapper() emits EncodingWarning when encoding is omitted and warn_default_encoding is enabled.
* _pyio.TextIOWrapper() uses UTF-8 as fallback default encoding used when failed to import locale module. (used during building Python)
* bz2, configparser, gzip, lzma, pathlib, tempfile modules use io.text_encoding().
* What's new entry
2021-03-29 12:28:14 +09:00
Victor Stinner 28ad12f8fe
bpo-43244: Remove symtable.h header file (GH-24910)
Rename Include/symtable.h to to Include/internal/pycore_symtable.h,
don't export symbols anymore (replace PyAPI_FUNC and PyAPI_DATA with
extern) and rename functions:

* PyST_GetScope() to _PyST_GetScope()
* PySymtable_BuildObject() to _PySymtable_Build()
* PySymtable_Free() to _PySymtable_Free()

Remove PySymtable_Build(), Py_SymtableString() and
Py_SymtableStringObject() functions.

The Py_SymtableString() function was part the stable ABI by mistake
but it could not be used, since the symtable.h header file was
excluded from the limited C API.

The Python symtable module remains available and is unchanged.
2021-03-19 12:41:49 +01:00
Antoine Pitrou ba251c2ae6
bpo-43356: Allow passing a signal number to interrupt_main() (GH-24755)
Also introduce a new C API ``PyErr_SetInterruptEx(int signum)``.
2021-03-11 23:35:45 +01:00
Jozef Grajciar c994ffe695
bpo-11717: fix ssize_t redefinition error when targeting 32bit Windows app (GH-24479) 2021-03-01 11:18:33 +00:00
Ikko Ashimine 4233ff3ee4
Fix typo in launcher.c (GH-24497) 2021-02-20 19:03:50 +09:00
Zackery Spytz 8a8b5df93f
bpo-43155: Add PyCMethod_New to PC/python3dll.c (GH-24500) 2021-02-16 01:14:13 +01:00
Ken Jin 28873a7050
Fix signed/unsigned comparison to avoid compilation warning (GH-24441) 2021-02-04 21:38:18 +00:00
Victor Stinner e8e66eab94 bpo-41713: Remove PyOS_InitInterrupts() from python3dll.c (GH-24257) 2021-01-19 18:27:01 +01:00
Dong-hee Na 2396614b89
bpo-1635741: Fix PyModule_AddObjectRef to use EXPORT_FUNC (GH-24205) 2021-01-13 19:15:40 +09:00
Victor Stinner 0e2a0f72cc
bpo-42802: Remove distutils bdist_wininst command (GH-24043)
The distutils bdist_wininst command deprecated in Python 3.8 has been
removed. The distutils bidst_wheel command is now recommended to
distribute binary packages on Windows.

* Remove Lib/distutils/command/bdist_wininst.py
* Remove PC/bdist_wininst/ project
* Remove Lib/distutils/command/wininst-*.exe programs
* Remove all references to bdist_wininst
2021-01-09 00:35:01 +01:00
Dong-hee Na de6f20a6de
Bring Python into the new year. (GH-24036) 2021-01-02 00:37:23 +09:00
Victor Stinner fcc6935384
Add symbols of the stable ABI to python3dll.c (GH-23598)
Add the following symbols to python3dll.c:

* PyFrame_GetCode (bpo-40421)
* PyFrame_GetLineNumber (bpo-40421)
* PyModule_AddObjectRef (bpo-1635741)
* PyObject_CallNoArgs (bpo-37194)
* PyThreadState_GetFrame (bpo-39947)
* PyThreadState_GetID (bpo-39947)
* PyThreadState_GetInterpreter (bpo-39947)
2020-12-16 15:08:23 +01:00
Victor Stinner b5c7b38f5e
bpo-42591: Export missing Py_FrozenMain() symbol (GH-23730)
Export the Py_FrozenMain() function: fix a Python 3.9.0 regression.
Python 3.9 uses -fvisibility=hidden and the function was not exported
explicitly and so not exported.

Add also Py_FrozenMain to the stable ABI on Windows.
2020-12-10 18:39:17 +01:00
Petr Viktorin c168b5078f
bpo-42111: Make the xxlimited module an example of best extension module practices (GH-23226)
- Copy existing xxlimited to xxlimited53 (named for the limited API version it uses)
- Build both modules, both in debug and release
- Test both modules
2020-12-08 08:36:53 -08:00
Victor Stinner 32bd68c839
bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587)
No longer use deprecated aliases to functions:

* Replace PyObject_MALLOC() with PyObject_Malloc()
* Replace PyObject_REALLOC() with PyObject_Realloc()
* Replace PyObject_FREE() with PyObject_Free()
* Replace PyObject_Del() with PyObject_Free()
* Replace PyObject_DEL() with PyObject_Free()
2020-12-01 10:37:39 +01:00
Victor Stinner 00d7abd7ef
bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)
No longer use deprecated aliases to functions:

* Replace PyMem_MALLOC() with PyMem_Malloc()
* Replace PyMem_REALLOC() with PyMem_Realloc()
* Replace PyMem_FREE() with PyMem_Free()
* Replace PyMem_Del() with PyMem_Free()
* Replace PyMem_DEL() with PyMem_Free()

Modify also the PyMem_DEL() macro to use directly PyMem_Free().
2020-12-01 09:56:42 +01:00
Steve Dower 9cc9e27725
bpo-42120: Remove macro defining copysign to _copysign on Windows (GH-23326) 2020-11-16 23:22:42 +00:00
Zackery Spytz f62dad16b8
bpo-38506: Fix the Windows py.exe launcher's misordering of 3.10 (GH-18307) 2020-11-16 21:32:35 +00:00
Mark Shannon c6409156c4
Bump magic number. (GH-23245) 2020-11-12 10:42:44 +00:00
Petr Viktorin 0b9c4c6fcf
bpo-42171: Add PEP573-related items to the limited API (GH-23009) 2020-11-10 05:47:31 -08:00
Victor Stinner 53a03aafd5
bpo-42262: Add Py_NewRef() and Py_XNewRef() (GH-23152)
Added Py_NewRef() and Py_XNewRef() functions to increment the reference
count of an object and return the object.
2020-11-05 15:02:12 +01:00
Steve Dower 6d883fbe14
bpo-38439: Update the Windows Store package's icons for IDLE. Artwork by Andrew Clover (GH-22817) 2020-10-20 15:54:13 +01:00
Zackery Spytz 1438c2ac77
bpo-41845: Move PyObject_GenericGetDict() back into the limited API (GH22646)
It was moved out of the limited API in 7d95e40721.
This change re-enables it from 3.10, to avoid generating invalid extension modules for earlier versions.
2020-10-19 23:47:37 +01:00
Alex Gaynor 3a8fdb2879
bpo-41784: make PyUnicode_AsUTF8AndSize part of the limited API (GH-22252) 2020-10-19 23:17:50 +01:00
Vladimir Matveev cfb0f57ff8
bpo-41756: Export PyGen_Send and wrap it in if-defs (#22677) 2020-10-13 10:26:51 -07:00
Victor Stinner 19c3ac92bf
bpo-41834: Remove _Py_CheckRecursionLimit variable (GH-22359)
Remove the global _Py_CheckRecursionLimit variable: it has been
replaced by ceval.recursion_limit of the PyInterpreterState
structure.

There is no need to keep the variable for the stable ABI, since
Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() were not usable
in Python 3.8 and older: these macros accessed PyThreadState members,
whereas the PyThreadState structure is opaque in the limited C API.
2020-09-23 14:04:57 +02:00
Terry Jan Reedy 31c9828ec0
bpo-41729: Fix test_winconsole failures (3) and hang (GH-22146)
The problems occured with a repository build on machine
with freshly updated Windows 10 Pro.
2020-09-12 01:51:52 -04:00
Victor Stinner 15edaecd97
bpo-40989: Fix compiler warning in winreg.c (GH-21722)
Explicitly cast PyHKEYObject* to PyObject* to call _PyObject_Init().
2020-08-05 16:23:10 +02:00
Steve Dower 936a660945
bpo-41304: Ensure python3x._pth is loaded on Windows (GH-21495) 2020-07-15 22:56:49 +01:00
Serhiy Storchaka 4c8f09d7ce
bpo-36346: Make using the legacy Unicode C API optional (GH-21437)
Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0
makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
2020-07-10 23:26:06 +03:00
Victor Stinner 8182cc2e68
bpo-39573: Use the Py_TYPE() macro (GH-21433)
Replace obj->ob_type with Py_TYPE(obj).
2020-07-10 12:40:38 +02:00
Steve Dower dcbaa1b49c
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297)
Also enables using debug build of `python3_d.dll`
Reference: CVE-2020-15523
2020-07-06 17:32:00 +01:00
Serhiy Storchaka b3dd5cd4a3
bpo-36346: Undeprecate private function _PyUnicode_AsUnicode(). (GH-21336) 2020-07-05 18:53:45 +03:00
Serhiy Storchaka 5d5c84ef78
bpo-41187: Convert the _msi module to Argument Clinic (GH-21264) 2020-07-01 21:53:07 +03:00
Serhiy Storchaka ba67d7386e
bpo-41142: Add support of non-ASCII paths for CAB files. (GH-21195)
* The path to the CAB file can be non-ASCII.
* Paths of added files can be non-ASCII.
2020-06-30 11:56:03 +03:00
Serhiy Storchaka 349f76c6aa
bpo-36346: Prepare for removing the legacy Unicode C API (AC only). (GH-21223) 2020-06-30 09:03:15 +03:00
Inada Naoki 6f8a6ee59c
bpo-41103: Remove old buffer protocol support (#21117)
They are deprecated since Python 3.0.
2020-06-26 08:07:22 +09:00
Serhiy Storchaka 55939b1708
bpo-41074: Fix support of non-ASCII names and SQL in msilib. (GH-21126)
* Fix support of non-ASCII names in functions OpenDatabase()
  and init_database().
* Fix support of non-ASCII SQL in method Database.OpenView().
2020-06-25 11:37:12 +03:00
Nikita Nemkin 33b79b11b8
bpo-41038: Fix non-ASCII string corruption in Win32 resource files (GH-20985)
In absence of explicit declaration, resource compiler uses system
codepage. When this codepage is DBCS or UTF-8, Python's copyright
string is corrupted, because it contains copyright sign encoded
as \xA9.

The fix is to explicitly declare codepage 1252.
2020-06-24 17:27:42 +01:00
Nikita Nemkin bbf36e8903
bpo-41070: Simplify pyshellext.dll build (GH-21037)
Replace MIDL-generated file with manual GUID definition.
Use the same .def file for release and debug builds.
Update setup build to support latest toolset
2020-06-24 00:32:23 +01:00
Nikita Nemkin 2c6e4e91c5
bpo-41039: Simplify python3.dll build (GH-20989)
Use linker comment #pragma and preprocessor for re-exporting stable
API functions and variables.

Module definition file, custom build targets and entry point code
become unnecessary and can be removed.

This change also fixes missing _PyErr_BadInternalCall export on x86.
2020-06-23 20:33:23 +01:00
Nikita Nemkin 4efc3360c9
bpo-41054: Simplify resource compilation on Windows (GH-21004)
Remove auto-generated resource header. Pass definitions required
by resource files (ORIGINAL_FILENAME and FIELD3) directly to resource
compiler.

Remove unused MS_DLL_ID resource string and related dead code.
2020-06-23 20:05:57 +01:00
Nikita Nemkin fe2a48c605
bpo-41089: Filters and other issues in Visual Studio projects (GH-21070)
* Add missing header files to pythoncore.
* Add missing file filters ("Resource Files" in particular) to
  all projects.
* Add new sub-filters for private headers in pythoncore and
  for 3rd party source files.
* Add missing _zoneinfo configurations in pcbuild.sln.
* Update bdist_wininst with the new zlib location.
2020-06-23 19:41:49 +01:00
Victor Stinner 04fc4f2a46
bpo-40989: PyObject_INIT() becomes an alias to PyObject_Init() (GH-20901)
The PyObject_INIT() and PyObject_INIT_VAR() macros become aliases to,
respectively, PyObject_Init() and PyObject_InitVar() functions.

Rename _PyObject_INIT() and _PyObject_INIT_VAR() static inline
functions to, respectively, _PyObject_Init() and _PyObject_InitVar(),
and move them to pycore_object.h. Remove their return value:
their return type becomes void.

The _datetime module is now built with the Py_BUILD_CORE_MODULE macro
defined.

Remove an outdated comment on _Py_tracemalloc_config.
2020-06-16 01:28:07 +02:00
Steve (Gadget) Barnes b3e6783423
bpo-37556 Extend help to include latest overrides (GH-14701)
Modify the help in cpython/PC/launcher.c to show users that "latest" can be overridden by shebang, PY_PYTHON[n] or py.ini files. Also show that script [args] is optional by enclosing in square brackets.

Automerge-Triggered-By: @zooba
2020-06-12 16:19:34 -07:00
Pablo Galindo 1ed83adb0e
bpo-40939: Remove the old parser (GH-20768)
This commit removes the old parser, the deprecated parser module, the old parser compatibility flags and environment variables and all associated support code and documentation.
2020-06-11 17:30:46 +01:00
Victor Stinner f6e58aefde
bpo-40826: Fix test_repl.test_close_stdin() on Windows (GH-20779)
test_repl.test_close_stdin() now calls
support.suppress_msvcrt_asserts() to fix the test on Windows.

* Move suppress_msvcrt_asserts() from test.libregrtest.setup to
  test.support. Make its verbose parameter optional: verbose=False by
  default.
* Add msvcrt.GetErrorMode().
* SuppressCrashReport now uses GetErrorMode() and SetErrorMode() of
  the msvcrt module, rather than using ctypes.
* Remove also an unused variable (deadline) in wait_process().
2020-06-10 18:49:23 +02:00
Victor Stinner e81f6e687d
bpo-40910: Export Py_GetArgcArgv() function (GH-20721)
Export explicitly the Py_GetArgcArgv() function to the C API and
document the function. Previously, it was exported implicitly which
no longer works since Python is built with -fvisibility=hidden.

* Add PyConfig._orig_argv member.
* Py_InitializeFromConfig() no longer calls _PyConfig_Write() twice.
* PyConfig_Read() no longer initializes Py_GetArgcArgv(): it is now
  _PyConfig_Write() responsibility.
* _PyConfig_Write() result type becomes PyStatus instead of void.
* Write an unit test on Py_GetArgcArgv().
2020-06-08 18:12:59 +02:00
Serhiy Storchaka 578c3955e0
bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)
Only __index__ should be used to make integer conversions lossless.
2020-05-26 18:43:38 +03:00
Pablo Galindo d4fe098d1e
Python 3.10.0a0 (GH-20198) 2020-05-19 03:33:01 +01:00
Minmin Gong 98e42d1f88
bpo-35890: Use RegQueryInfoKeyW and CryptAcquireContextW explicitly (GH-19974) 2020-05-18 17:50:03 +01:00
Victor Stinner ae00a5a885
bpo-40428: Remove PyTuple_ClearFreeList() function (GH-19769)
Remove the following function from the C API:

* PyAsyncGen_ClearFreeLists()
* PyContext_ClearFreeList()
* PyDict_ClearFreeList()
* PyFloat_ClearFreeList()
* PyFrame_ClearFreeList()
* PyList_ClearFreeList()
* PySet_ClearFreeList()
* PyTuple_ClearFreeList()

Make these functions private, move them to the internal C API and
change their return type to void.

Call explicitly PyGC_Collect() to free all free lists.

Note: PySet_ClearFreeList() did nothing.
2020-04-29 02:29:20 +02:00
Pablo Galindo c5fc156852
bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-04-22 23:29:27 +01:00
Victor Stinner 361dcdcefc
bpo-40268: Remove unused osdefs.h includes (GH-19532)
When the include is needed, add required symbol in a comment.
2020-04-15 03:24:57 +02:00
Victor Stinner 4a21e57fe5
bpo-40268: Remove unused structmember.h includes (GH-19530)
If only offsetof() is needed: include stddef.h instead.

When structmember.h is used, add a comment explaining that
PyMemberDef is used.
2020-04-15 02:35:41 +02:00
Victor Stinner e5014be049
bpo-40268: Remove a few pycore_pystate.h includes (GH-19510) 2020-04-14 17:52:15 +02:00
Victor Stinner 9205520d8c
bpo-40170: PyObject_NEW() becomes an alias to PyObject_New() (GH-19379)
The PyObject_NEW() macro becomes an alias to the PyObject_New()
macro, and the PyObject_NEW_VAR() macro becomes an alias to the
PyObject_NewVar() macro, to hide implementation details. They no
longer access directly the PyTypeObject.tp_basicsize member.

Exclude _PyObject_SIZE() and _PyObject_VAR_SIZE() macros from
the limited C API.

Replace PyObject_NEW() with PyObject_New() and replace
PyObject_NEW_VAR() with PyObject_NewVar().
2020-04-08 00:38:15 +02:00
Guido van Rossum 48b069a003
bpo-39481: Implementation for PEP 585 (#18239)
This implements things like `list[int]`,
which returns an object of type `types.GenericAlias`.
This object mostly acts as a proxy for `list`,
but has attributes `__origin__` and `__args__`
that allow recovering the parts (with values `list` and `(int,)`.

There is also an approximate notion of type variables;
e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`.
Type variables are objects of type `typing.TypeVar`.
2020-04-07 09:50:06 -07:00
Chris Martinez 6e623ff9d2
bpo-40158: Fix CPython MSBuild Properties in NuGet Package (GH-19343)
Fix default Python home path relative to the NuGet package
2020-04-03 21:03:54 +01:00
Zackery Spytz 676b105111
bpo-8901: Windows registry path is now ignored with the -E option (GH-18169) 2020-03-30 17:04:45 +01:00
Andy Lester 7668a8bc93
Use calloc-based functions, not malloc. (GH-19152) 2020-03-24 23:26:44 -05:00
Steve Dower fde44ae6d0
bpo-39930: Convert error to warning for more silent failure (GH-18921)
Makes it an error to create a layout without vcruntime DLL
2020-03-11 14:12:31 +00:00
Victor Stinner 8510f43078
bpo-1294959: Add sys.platlibdir attribute (GH-18381)
Add --with-platlibdir option to the configure script: name of the
platform-specific library directory, stored in the new sys.platlitdir
attribute. It is used to build the path of platform-specific dynamic
libraries and the path of the standard library.

It is equal to "lib" on most platforms. On Fedora and SuSE, it is
equal to "lib64" on 64-bit systems.

Co-Authored-By: Jan Matějek <jmatejek@suse.com>
Co-Authored-By: Matěj Cepl <mcepl@cepl.eu>
Co-Authored-By: Charalampos Stratakis <cstratak@redhat.com>
2020-03-10 09:53:09 +01:00
Stefan Krah 815280eb16
bpo-39794: Add --without-decimal-contextvar (#18702) 2020-02-29 19:43:42 +01:00
Steve Dower 03153dd145
bpo-39789: Update Windows release build machines to VS 2019 (GH-18695)
Also fixes some potential Nuget build issues.
2020-02-29 00:21:46 +00:00
Steve Dower d644891970
bpo-38403: Update nuspec file for deprecated field and git repository (GH-18657) 2020-02-25 20:07:00 +00:00
Steve Dower 6c444d0dab
bpo-39184: Fix incorrect return value (GH-18580)
https://bugs.python.org/issue39184



Automerge-Triggered-By: @zooba
2020-02-20 14:24:43 -08:00
Saiyang Gou 7514f4f625
bpo-39184: Add audit events to functions in `fcntl`, `msvcrt`, `os`, `resource`, `shutil`, `signal`, `syslog` (GH-18407) 2020-02-13 07:47:42 +00:00
Victor Stinner 877ea88934
bpo-38644: Add Py_EnterRecursiveCall() to python3.def (GH-18399)
Add Py_EnterRecursiveCall and Py_LeaveRecursiveCall functions to
python3.def.
2020-02-07 11:22:54 +01:00
Zackery Spytz b439a715cb
bpo-39553: Delete HAVE_SXS protected code (GH-18356)
https://bugs.python.org/issue39553



Automerge-Triggered-By: @zooba
2020-02-04 19:13:00 -08:00
Steve Dower 6a65eba44b
bpo-39401: Avoid unsafe DLL load on Windows 7 and earlier (GH-18231)
As Windows 7 is not supported by Python 3.9, we just replace the dynamic load with a static import. Backports will have a different fix to ensure they continue to behave the same.
2020-01-29 13:46:33 +11:00
Mark Shannon 9af0e47b17
bpo-39156: Break up COMPARE_OP into four logically distinct opcodes. (GH-17754)
Break up COMPARE_OP into four logically distinct opcodes:
* COMPARE_OP for rich comparisons
* IS_OP for 'is' and 'is not' tests
* CONTAINS_OP for 'in' and 'is not' tests
* JUMP_IF_NOT_EXC_MATCH for checking exceptions in 'try-except' statements.
2020-01-14 10:12:45 +00:00
Steve Dower d0802d07d2
bpo-39012: Fix RC version suffix for nuget release files (GH-17564) 2019-12-10 15:19:03 -08:00
Steve Dower ee17e37356
bpo-39007: Add auditing events to functions in winreg (GH-17541)
Also allows winreg.CloseKey() to accept same types as other functions.
2019-12-09 11:18:12 -08:00
Steve Dower e89e159b18
Fix APPX registry key generation (GH-17489) 2019-12-09 08:43:13 -08:00
Victor Stinner d68b592dd6
bpo-38896: Remove PyUnicode_ClearFreeList() function (GH-17354)
Remove PyUnicode_ClearFreeList() function: the Unicode free list has
been removed in Python 3.3.
2019-11-23 02:30:32 +01:00
Steve Dower de148f263f
bpo-33125: Add support for building and releasing Windows ARM64 packages (GH-16828)
Note that the support is not actually enabled yet, and so we won't be publishing these packages. However, for those who want to build it themselves (even by reusing the Azure Pipelines definition), it's now relatively easy to enable.
2019-11-20 09:30:47 -08:00
Steve Dower db7925a1ca
Update information about publishing a new version to the Microsoft Store (GH-17262) 2019-11-20 08:21:14 -08:00
Zackery Spytz edb172a872 bpo-38519: Internal include files missing on Windows (GH-16921) 2019-10-28 10:03:27 -07:00
Sergey Fedoseev a9ed91e6c2 bpo-27961: Replace PY_LONG_LONG with long long. (GH-15386) 2019-10-21 09:49:48 +03:00
Victor Stinner c02b41b1fb
bpo-38353: getpath.c: allocates strings on the heap (GH-16585)
* _Py_FindEnvConfigValue() now returns a string allocated
  by PyMem_RawMalloc().
* calculate_init() now decodes VPATH macro.
* Add calculate_open_pyenv() function.
* Add substring() and joinpath2() functions.

* Fix add_exe_suffix()

And a few cleanup changes.
2019-10-04 19:53:43 +02:00
Steve Dower 353fb1ecbf
bpo-38359: Ensures pyw.exe launcher reads correct registry key (GH-16561) 2019-10-03 08:31:21 -07:00
Victor Stinner 61691d8336
bpo-38353: Cleanup includes in the internal C API (GH-16548)
Use forward declaration of types to avoid includes in the internal C
API. Add also comment to justify other includes.
2019-10-02 23:51:20 +02:00
Steve Dower b9a8b8296c
bpo-38343: Fixes version handling for nuget packages (GH-16527) 2019-10-01 16:42:24 -07:00
Victor Stinner 8462a4936b
bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509)
PyConfig_InitPythonConfig() and PyConfig_InitIsolatedConfig() no
longer return PyStatus: they cannot fail anymore.
2019-10-01 12:06:16 +02:00
Victor Stinner 3c30a76f3d
bpo-38304: Remove PyConfig.struct_size (GH-16500) (GH-16508)
For now, we'll rely on the fact that the config structures aren't covered by the stable ABI.

We may revisit this in the future if we further explore the idea of offering a stable embedding API.

(cherry picked from commit bdace21b76)
2019-10-01 10:56:37 +02:00
Victor Stinner dec39716ca
bpo-38322: Fix gotlandmark() of PC/getpathp.c (GH-16489)
Write the filename into a temporary buffer instead of reusing prefix.
The problem is that join() modifies prefix inplace. If prefix is not
normalized, join() can make prefix shorter and so gotlandmark()
does modify prefix instead of returning it unmodified.
2019-09-30 14:49:34 +02:00
Victor Stinner 89f8177dcf
bpo-38304: Fix PyConfig usage in python_uwp.cpp (GH-16487)
* Set PyPreConfig.struct_size and PyConfig.struct_size as required by
  the API.
* PyPreConfig_InitPythonConfig() can now fail: check PyStatus result.
2019-09-30 12:52:29 +02:00
Victor Stinner 8bf39b606e
bpo-38234: Add test_init_setpath_config() to test_embed (GH-16402)
* Add test_embed.test_init_setpath_config(): test Py_SetPath()
  with PyConfig.
* test_init_setpath() and test_init_setpythonhome() no longer call
  Py_SetProgramName(), but use the default program name.
* _PyPathConfig: isolated, site_import  and base_executable
  fields are now only available on Windows.
* If executable is set explicitly in the configuration, ignore
  calculated base_executable: _PyConfig_InitPathConfig() copies
  executable to base_executable.
* Complete path config documentation.
2019-09-26 02:22:35 +02:00
Victor Stinner 221fd84703
bpo-38234: Cleanup getpath.c (GH-16367)
* search_for_prefix() directly calls reduce() if found is greater
  than 0.
* Add calculate_pybuilddir() subfunction.
* search_for_prefix(): add path string buffer for readability.
* Fix some error handling code paths: release resources on error.
* calculate_read_pyenv(): rename tmpbuffer to filename.
* test.pythoninfo now also logs windows.dll_path
2019-09-25 02:54:25 +02:00
Victor Stinner 85ce0a7178
bpo-38234: read_pth_file() now returns PyStatus (GH-16338)
Refactor path configuration code:

* read_pth_file() now returns PyStatus to report errors, rather than
  calling Py_FatalError().
* Move argv0_path and zip_path buffers out of PyCalculatePath
  structures.
* On Windows, _PyPathConfig.home is now preferred over PyConfig.home.
2019-09-24 00:55:48 +02:00
Victor Stinner 9c42f8cda5
bpo-38234: Fix _PyConfig_InitPathConfig() (GH-16335)
* _PyConfig_InitPathConfig() now starts by copying the global path
  configuration, and then override values set in PyConfig.
* _PyPathConfig_Calculate() implementations no longer override
  _PyPathConfig fields which are already computed. For example,
  if _PyPathConfig.prefix is not NULL, leave it unchanged.
* If Py_SetPath() has been called, _PyConfig_InitPathConfig() doesn't
  call _PyPathConfig_Calculate() anymore.
* _PyPathConfig_Calculate() no longer uses PyConfig,
  except to initialize PyCalculatePath structure.
* pathconfig_calculate(): remove useless temporary
  "_PyPathConfig new_config" variable.
* calculate_module_search_path(): remove hack to workaround memory
  allocation failure, call Py_FatalError() instead.
* Fix get_program_full_path(): handle memory allocation failure.
2019-09-23 18:47:29 +02:00
Victor Stinner fcdb027234
bpo-38236: Dump path config at first import error (GH-16300)
Python now dumps path configuration if it fails to import the Python
codecs of the filesystem and stdio encodings.
2019-09-23 14:45:47 +02:00
Victor Stinner e267793aa4
bpo-38234: Fix PyConfig_Read() when Py_SetPath() was called (GH-16298)
* If Py_SetPath() has been called, _PyConfig_InitPathConfig() now
  uses its value.
* Py_Initialize() now longer copies path configuration from PyConfig
  to the global path configuration (_Py_path_config).
2019-09-21 01:50:16 +02:00
Victor Stinner c422167749
bpo-38234: Remove _PyPathConfig.dll_path (GH-16307)
The DLL path is not computed from any user configuration and cannot
be configured by PyConfig. Instead, add a new _Py_dll_path global variable.

Remove _PyConfig_SetPathConfig(): replaced with _PyPathConfig_Init().

Py_Initialize() now longer sets the "global path configuration",
but only initialize _Py_dll_path.
2019-09-21 01:02:56 +02:00
Steve Dower ed93a8852d
bpo-38133: Allow py.exe launcher to locate installations from the Microsoft Store (GH-16025) 2019-09-12 18:16:50 +01:00
Steve Dower 0b72ccff56 bpo-32592: Set Windows 8 as the minimum required version for API support (GH-15951) 2019-09-11 17:03:37 +01:00
Steve Dower 19f6940cd7 bpo-38114: Do not include pip.ini in Nuget package (GH-15964) 2019-09-11 16:16:27 +01:00
Steve Dower ef66f31ce2 bpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766) 2019-09-09 14:24:15 +01:00
Zackery Spytz 19052a1131 bpo-37705: Improve the implementation of winerror_to_errno() (GH-15623)
winerror_to_errno() is no longer automatically generated.
Do not rely on the old _dosmapperr() function.
Add ERROR_NO_UNICODE_TRANSLATION (1113) -> EILSEQ.
2019-09-09 02:35:08 -07:00
Zackery Spytz e223ba13d8 bpo-32587: Make winreg.REG_MULTI_SZ support zero-length strings (#13239)
* bpo-32587: Make winreg.REG_MULTI_SZ support PendingFileRenameOperations

* Address review comments.
2019-09-09 02:26:15 -07:00
Zackery Spytz a6563650c8 bpo-37445: Include FORMAT_MESSAGE_IGNORE_INSERTS in FormatMessageW() calls (GH-14462)
If FormatMessageW() is passed the FORMAT_MESSAGE_FROM_SYSTEM flag without FORMAT_MESSAGE_IGNORE_INSERTS, it will fail if there are insert sequences in the message definition.
2019-09-09 02:20:38 -07:00
Rémi Lapeyre 4901fe274b bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593) 2019-08-29 17:49:08 +03:00
Nick Coghlan 5dbe0f59b7
bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15131)
- drop TargetScopeError in favour of raising SyntaxError directly
  as per the updated PEP 572
- comprehension iteration variables are explicitly local, but
  named expression targets in comprehensions are nonlocal or
  global. Raise SyntaxError as specified in PEP 572
- named expression targets in the outermost iterable of a
  comprehension have an ambiguous target scope. Avoid resolving
  that question now by raising SyntaxError. PEP 572
  originally required this only for cases where the bound name
  conflicts with the iteration variable in the comprehension,
  but CPython can't easily restrict the exception to that case
  (as it doesn't know the target variable names when visiting
  the outermost iterator expression)
2019-08-25 23:45:40 +10:00
Serhiy Storchaka ef61c524dd
bpo-37830: Fix compilation of break and continue in finally. (GH-15320)
Fix compilation of "break" and "continue" in the
"finally" block when the corresponding "try" block
contains "return" with a non-constant value.
2019-08-24 13:11:52 +03:00
Dong-hee Na 0a18ee4be7 bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266) 2019-08-23 15:20:30 -07:00
Sergey Fedoseev a38e9d1399 bpo-27961: Remove leftovers from the times when long long wasn't required (GH-15388) 2019-08-22 16:28:28 +01:00
Steve Dower c1aeb292d2
Remove versioned executables from non-APPX packages (GH-15237) 2019-08-12 14:56:39 -07:00
Steve Dower 0378d98678
bpo-37734: Remove unnecessary brace escapes in PC/layout script (GH-15165) 2019-08-07 11:39:09 -07:00
Steve Dower 87ce9588ce
bpo-37778: Fixes the icons used for file associations to the Microsoft Store package (GH-15150) 2019-08-07 10:50:17 -07:00
Steve Dower 1fab9cbfba
bpo-37734: Fix use of registry values to launch Python from Microsoft Store app (GH-15146) 2019-08-07 10:49:40 -07:00
David H ed5e8e06cb bpo-37730: Fix usage of NotImplemented instead of NotImplementedError in docs. (GH-15062) 2019-08-01 01:49:55 +03:00
Min ho Kim c4cacc8c5e Fix typos in comments, docs and test names (#15018)
* Fix typos in comments, docs and test names

* Update test_pyparse.py

account for change in string length

* Apply suggestion: splitable -> splittable

Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>

* Apply suggestion: splitable -> splittable

Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>

* Apply suggestion: Dealloccte -> Deallocate

Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>

* Update posixmodule checksum.

* Reverse idlelib changes.
2019-07-30 18:16:13 -04:00
Bill Collins c4cda4369f bpo-37641 preserve relative file location in embeddable zip (GH-14884)
Previously, pyc files in the embeddable distribution reported their
location as <build path>/<file stem>.py. This causes a little confusion
when interpreting stack traces as the file is in a (almost certainly)
incorrect location, and lacks the full relative path to Lib (e.g.
email/mime/image.py will only show image.py).

This change preserves the Lib relative location of the source file as a
path so that stack traces are (hopefully) less misleading and more
informative.

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
2019-07-25 14:36:58 -07:00
Steve Dower 123536fdab
bpo-37672: Switch Windows Store package to use pip.ini for user mode (GH-14939) 2019-07-24 15:13:22 -07:00
Steve Dower ac14632c75
bpo-37369: Fixes crash when reporting fatal error (GH-14468) 2019-06-29 14:28:43 -07:00
Steve Dower 9048c49322
bpo-37369: Fix initialization of sys members when launched via an app container (GH-14428)
sys._base_executable is now always defined on all platforms, and can be overridden through configuration.
Also adds test.support.PythonSymlink to encapsulate platform-specific logic for symlinking sys.executable
2019-06-29 10:34:11 -07:00