Commit Graph

106022 Commits

Author SHA1 Message Date
Siwon Kang 91daa9d722 bpo-38863: Improve is_cgi() in http.server (GH-17312)
is_cgi() function of http.server library does not currently handle a
cgi script if one of the cgi_directories is located at the
sub-directory of given path. Since is_cgi() in CGIHTTPRequestHandler
class separates given path into (dir, rest) based on the first seen
'/', multi-level directories like /sub/dir/cgi-bin/hello.py is divided
into head=/sub, rest=dir/cgi-bin/hello.py then check whether '/sub'
exists in cgi_directories = [..., '/sub/dir/cgi-bin'].
This patch makes the is_cgi() keep expanding dir part to the next '/'
then checking if that expanded path exists in the cgi_directories.

Signed-off-by: Siwon Kang <kkangshawn@gmail.com>





https://bugs.python.org/issue38863
2019-11-22 01:13:05 -08:00
Raymond Hettinger b4e5eeac26
Defer import of shutil which only needed for help and usage (GH-17334) 2019-11-21 22:51:45 -08:00
Claudiu Popa 65444cf7fe bpo-38526: Fix zipfile.Path method name to be the correct one (#17317) 2019-11-21 16:23:13 -05:00
benedwards14 0aca3a3a1e bpo-37838: get_type_hints for wrapped functions with forward reference (GH-17126)
https://bugs.python.org/issue37838
2019-11-21 17:24:58 +00:00
Mark Shannon 82f897bf8f
Correct release version to 3.9 for RERAISE and WITH_EXCEPT_START bytecodes. (#17318)
bpo-33387

Corrects commit fee5526
2019-11-21 14:47:49 +00:00
Victor Stinner 3ab479a2d1
bpo-38692: Skip test_posix.test_pidfd_open() on EPERM (GH-17290)
Skip the test_posix.test_pidfd_open() test if os.pidfd_open() fails
with a PermissionError. This situation can happen in a Linux sandbox
using a syscall whitelist which doesn't allow the pidfd_open()
syscall yet (like systemd-nspawn).
2019-11-21 12:54:54 +01:00
Victor Stinner 0127bb1c5c
bpo-38875: test_capi: trashcan tests require cpu resource (GH-17314)
test_capi: trashcan tests now require the test "cpu" resource.
2019-11-21 12:54:02 +01:00
Giampaolo Rodola 5c534da798
CODEOWNERS: add myself for asyncore/chat, ftplib and shutil modules (#17313) 2019-11-21 17:38:51 +08:00
Mark Shannon fee552669f
Produce cleaner bytecode for 'with' and 'async with' by generating separate code for normal and exceptional paths. (#6641)
Remove BEGIN_FINALLY, END_FINALLY, CALL_FINALLY and POP_FINALLY bytecodes. Implement finally blocks by code duplication.
Reimplement frame.lineno setter using line numbers rather than bytecode offsets.
2019-11-21 09:11:43 +00:00
Victor Stinner 5dcc06f6e0
bpo-38858: Allocate small integers on the heap (GH-17301)
Allocate small Python integers (small_ints of longobject.c) on the
heap, rather than using static objects.
2019-11-21 08:51:59 +01:00
Géry Ogam d67279147a Update functions.rst (GH-16468)
This PR will make the following changes to the [_Built-in Functions_](https://docs.python.org/3/library/functions.html) chapter of the library documentation:

- improve hyperlinks in Sphinx roles (trailing 's' belong to hyperlinks).

Automerge-Triggered-By: @csabella
2019-11-20 18:10:19 -08:00
Dave Nguyen 9391f6c3ef bpo-36277: Add document for pdb debug and retval commands (GH-12872)
https://bugs.python.org/issue36277



Automerge-Triggered-By: @csabella
2019-11-20 17:49:15 -08:00
Jules Lasne (jlasne) 6db2fb7c30 Removed capital letter in parameter in stdtypes.rst (GH-17218)
Automerge-Triggered-By: @csabella
2019-11-20 17:30:05 -08:00
Aveheuzed 06ca2a2be9 Fixed an incorrect sentence in the docs (GH-17205)
Fixed an incorrect sentence in Doc/c-api/mapping.rst I fell on
while translating the file.

skip issue

Automerge-Triggered-By: @csabella
2019-11-20 17:19:00 -08:00
Jason Fried 046442d02b bpo-38857: AsyncMock fix for awaitable values and StopIteration fix [3.8] (GH-17269) 2019-11-20 16:27:51 -08:00
Brandt Bucher e5d1f734db bpo-38823: Clean up _xxtestfuzz initialization. (GH-17216)
https://bugs.python.org/issue38823
2019-11-20 16:17:02 -08:00
xdegaye 559bad1a70 bpo-38841: Skip asyncio test_create_datagram_endpoint_existing_sock_unix (GH-17294)
on platforms lacking a functional bind() for named unix domain sockets



https://bugs.python.org/issue38841



Automerge-Triggered-By: @asvetlov
2019-11-20 12:02:07 -08:00
Victor Stinner b93f31fcd9
bpo-38858: Fix Py_Finalize() when called from a subinterpreter (GH-17297)
Use _Py_IsMainInterpreter() in Py_Initialize() and Py_Finalize() to
detect if the current interpreter is the main interpreter or not.
2019-11-20 18:39:12 +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
Segev Finer abce2d9bc6 Add Python 3.8 to py based search in find_python.bat (GH-17188) 2019-11-20 09:25:45 -08:00
Victor Stinner fff7bbfdb6
bpo-38858: Add _Py_IsMainInterpreter(tstate) (GH-17293) 2019-11-20 17:34:39 +01: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
Federico Bond be5c79e033 bpo-38821: Fix crash in argparse when using gettext (GH-17192) 2019-11-20 15:29:29 +02:00
Victor Stinner 4dedd0f0dd
bpo-37340: Remove PyMethod_ClearFreeList() and PyCFunction_ClearFreeList() (GH-17284)
Remove PyMethod_ClearFreeList() and PyCFunction_ClearFreeList()
functions: the free lists of bound method objects have been removed.

Remove also _PyMethod_Fini() and _PyCFunction_Fini() functions.
2019-11-20 12:59:12 +01:00
Victor Stinner 7247407c35
bpo-36854: Move _PyRuntimeState.gc to PyInterpreterState (GH-17287)
* Rename _PyGC_InitializeRuntime() to _PyGC_InitState()
* finalize_interp_clear() now also calls _PyGC_Fini() in
  subinterpreters (clear the GC state).
2019-11-20 12:25:50 +01:00
Victor Stinner 488d02a241
bpo-38835: Exclude PyFPE macros from the stable API (GH-17228)
Exclude PyFPE_START_PROTECT() and PyFPE_END_PROTECT() macros of
pyfpe.h from Py_LIMITED_API (stable API).
2019-11-20 12:17:09 +01:00
Victor Stinner e7e699e4df
bpo-38858: Fix reference leak in pycore_init_types() (GH-17286)
Only call _PyGC_Init(), _PyExc_Init() and _PyErr_Init() in
new_interpreter().
2019-11-20 12:08:13 +01:00
Victor Stinner 67e0de6f0b
bpo-36854: gcmodule.c gets its state from tstate (GH-17285)
* Add GCState type for readability
* gcmodule.c now gets its gcstate from tstate
* _PyGC_DumpShutdownStats() now expects tstate rather than runtime
* Rename "state" to "gcstate" for readability: to avoid confusion
  between "state" and "tstate" for example.
* collect() now only expects tstate: it gets gcstate from tstate.
* Pass tstate to _PyErr_xxx() functions
2019-11-20 11:48:18 +01:00
Victor Stinner 9da7430675
bpo-36854: Clear the current thread later (GH-17279)
Clear the current thread later in the Python finalization.

* The PyInterpreterState_Delete() function is now responsible
  to call PyThreadState_Swap(NULL).
* The tstate_delete_common() function is now responsible to clear the
  "autoTSSKey" thread local storage and it only clears it once the
  thread state is fully cleared. It allows to still get the current
  thread from TSS in tstate_delete_common().
2019-11-20 11:17:17 +01:00
Brandt Bucher d51a363a43 bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235) 2019-11-20 11:00:31 +01:00
Victor Stinner 7eee5beaf8
bpo-38858: Factorize Py_EndInterpreter() code (GH-17273)
* Factorize code in common between Py_FinalizeEx() and
  Py_EndInterpreter().
* Py_EndInterpreter() now also calls _PyWarnings_Fini().
* Call _PyExc_Fini() and _PyGC_Fini() later in the finalization.
2019-11-20 10:38:34 +01:00
Terry Jan Reedy b8462477bf
bpo-38636: Fix IDLE tab toggle and file indent width (GH-17008)
These Format menu functions (default shortcuts Alt-T and Alt-U)
were mistakenly disabled in 3.7.5 and 3.8.0.
2019-11-20 01:18:39 -05:00
Benjamin Peterson 7483451577
closes bpo-38712: Add signal.pidfd_send_signal. (GH-17070)
This exposes a Linux-specific syscall for sending a signal to a process
identified by a file descriptor rather than a pid.

For simplicity, we don't support the siginfo_t parameter to the syscall. This
parameter allows implementing a pidfd version of rt_sigqueueinfo(2), which
Python also doesn't support.
2019-11-19 20:39:14 -08:00
Victor Stinner be143ec996
bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT (GH-17231)
The PyFPE_START_PROTECT() and PyFPE_END_PROTECT() macros are empty:
they have been doing nothing for the last year  (since commit
735ae8d139), so stop using them.
2019-11-20 02:51:30 +01:00
Victor Stinner 01b1cc12e7
bpo-36710: Add PyInterpreterState.runtime field (GH-17270)
Add PyInterpreterState.runtime field: reference to the _PyRuntime
global variable. This field exists to not have to pass runtime in
addition to tstate to a function.  Get runtime from tstate:
tstate->interp->runtime.

Remove "_PyRuntimeState *runtime" parameter from functions already
taking a "PyThreadState *tstate" parameter.

_PyGC_Init() first parameter becomes "PyThreadState *tstate".
2019-11-20 02:27:56 +01:00
Łukasz Langa eb1cbbff1c
Post 3.9.0a1 2019-11-20 02:06:33 +01:00
Łukasz Langa 1c5a71a7dd
Merge tag 'v3.9.0a1' 2019-11-20 02:05:28 +01:00
Brandt Bucher 33b671e724 bpo-38823: Fix refleak in marshal init error path (GH-17260) 2019-11-20 01:59:32 +01:00
Victor Stinner 2e96906da7
bpo-36710: Pass tstate parameter to GC collect() (GH-17267)
Pass tstate parameter (PyThreadState) to GC collect() function and
other GC subfunctions.
2019-11-20 01:49:32 +01:00
John Belmonte 279d8df5e5 bpo-38753: AsyncMock added in version 3.8 (GH-17102) 2019-11-19 16:30:43 -08:00
Victor Stinner 444b39bb64
bpo-38631: Avoid Py_FatalError() in handle_legacy_finalizers() (GH-17266)
* Rename _PyGC_Initialize() to _PyGC_InitializeRuntime()
* Add _PyGC_Init(): initialize _PyRuntime.gc.garbage list
* Call _PyGC_Init() before _PyTypes_Init()
2019-11-20 01:18:11 +01:00
Pablo Galindo e0cd8aa70a
bpo-37957: Allow regrtest to receive a file with test (and subtests) to ignore (GH-16989)
When building Python in some uncommon platforms there are some known tests that will fail. Right now, the test suite has the ability to ignore entire tests using the -x option and to receive a filter file using the --matchfile filter. The problem with the --matchfile option is that it receives a file with patterns to accept and when you want to ignore a couple of tests and subtests, is too cumbersome to lists ALL tests that are not the ones that you want to accept and he problem with -x is that is not easy to ignore just a subtests that fail and the whole test needs to be ignored.

For these reasons, add a new option to allow to ignore a list of test and subtests for these situations.
2019-11-19 23:46:49 +00:00
Victor Stinner ef5aa9af7c
bpo-38858: Reorganize pycore_init_types() (GH-17265)
* Call _PyLong_Init() and _PyExc_Init() earlier
* new_interpreter() reuses pycore_init_types()
2019-11-20 00:38:03 +01:00
Brandt Bucher ac2235432c bpo-38823: Fix refleaks in faulthandler init error path on Windows (GH-17250) 2019-11-20 00:13:05 +01:00
Pablo Galindo 293dd23477
Remove binding of captured exceptions when not used to reduce the chances of creating cycles (GH-17246)
Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles.

See for example GH-13135
2019-11-19 21:34:03 +00:00
Jake Tesler c6b20be85c bpo-38707: Fix for multiprocessing.Process MainThread.native_id (GH-17088)
This PR implements a fix for `multiprocessing.Process` objects; the error occurs when Processes are created using either `fork` or `forkserver` as the `start_method`.

In these instances, the `MainThread` of the newly created `Process` object retains all attributes from its parent's `MainThread` object, including the `native_id` attribute. The resulting behavior is such that the new process' `MainThread` captures an incorrect/outdated `native_id` (the parent's instead of its own). 

This change forces the Process object to update its `native_id` attribute during the bootstrap process.

cc @vstinner





https://bugs.python.org/issue38707



Automerge-Triggered-By: @pitrou
2019-11-19 11:50:12 -08:00
Adam Johnson 892221bfa0 bpo-38839: Fix some unused functions in tests (GH-17189) 2019-11-19 11:45:20 -08:00
Brandt Bucher 54b32c9871 bpo-38823: Clean up refleak in fcntl module initialization. (GH-17236) 2019-11-19 11:16:29 -08:00
Vincent Michel 8e0de2a480 bpo-35409: Ignore GeneratorExit in async_gen_athrow_throw (GH-14755)
Ignore `GeneratorExit` exceptions when throwing an exception into the `aclose` coroutine of an asynchronous generator.





https://bugs.python.org/issue35409
2019-11-19 05:53:52 -08:00
Jules Lasne (jlasne) f25875af42 Added missing coma after end of list in subprocess.rst (GH-17217)
Automerge-Triggered-By: @csabella
2019-11-19 04:14:53 -08:00