Commit graph

3343 commits

Author SHA1 Message Date
Victor Stinner 57364ce34e
bpo-43244: Remove parser_interface.h header file (GH-25001)
Remove parser functions using the "struct _mod" type, because the
AST C API was removed:

* PyParser_ASTFromFile()
* PyParser_ASTFromFileObject()
* PyParser_ASTFromFilename()
* PyParser_ASTFromString()
* PyParser_ASTFromStringObject()

These functions were undocumented and excluded from the limited C
API.

Add pycore_parser.h internal header file. Rename functions:

* PyParser_ASTFromFileObject() => _PyParser_ASTFromFile()
* PyParser_ASTFromStringObject() => _PyParser_ASTFromString()

These functions are no longer exported (replace PyAPI_FUNC() with
extern).

Remove also _PyPegen_run_parser_from_file() function. Update
test_peg_generator to use _PyPegen_run_parser_from_file_pointer()
instead.
2021-03-24 01:29:09 +01:00
Victor Stinner a81fca6ec8
bpo-43244: Add pycore_compile.h header file (GH-25000)
Remove the compiler functions using "struct _mod" type, because the
public AST C API was removed:

* PyAST_Compile()
* PyAST_CompileEx()
* PyAST_CompileObject()
* PyFuture_FromAST()
* PyFuture_FromASTObject()

These functions were undocumented and excluded from the limited C API.

Rename functions:

* PyAST_CompileObject() => _PyAST_Compile()
* PyFuture_FromASTObject() => _PyFuture_FromAST()

Moreover, _PyFuture_FromAST() is no longer exported (replace
PyAPI_FUNC() with extern). _PyAST_Compile() remains exported for
test_peg_generator.

Remove also compatibility functions:

* PyAST_Compile()
* PyAST_CompileEx()
* PyFuture_FromAST()
2021-03-24 00:51:50 +01: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
Christian Heimes 32eba61ea4
bpo-43466: Add --with-openssl-rpath configure option (GH-24820) 2021-03-19 10:29:25 +01:00
Ikko Ashimine ff8c77fe96
Fix a typo in c-analyzer (GH-24468) 2021-03-19 16:38:12 +09:00
Victor Stinner 6af528b4ab
bpo-43244: Fix test_peg_generators on Windows (GH-24913)
Don't redefine Py_DebugFlag, it's already defined in pydebug.h which
is included by Python.h
2021-03-18 09:54:13 +01:00
Victor Stinner e0bf70d08c
bpo-43244: Fix test_peg_generator for PyAST_Validate() (GH-24912)
test_peg_generator now defines _Py_TEST_PEGEN macro when building C
code to not call PyAST_Validate() in Parser/pegen.c. Moreover, it
defines Py_BUILD_CORE_MODULE macro to get access to the internal
C API.

Remove "global_ast_state" from Python-ast.c when it's built by
test_peg_generator: always get the AST state from the current interpreter.
2021-03-18 02:46:06 +01:00
Elisha Hollander e272528bbd
Remove unnecessary imports in the grammar parser (GH-24904) 2021-03-17 22:07:17 +00:00
Raymond Hettinger d69ae758a0
Minor updates to the vector demo (GH-24853) 2021-03-15 19:53:58 -07:00
Victor Stinner a9c03d7fb7
bpo-43456: Remove _xxsubinterpreters from sys.stdlib_module_names (GH-24814) 2021-03-10 12:10:01 +01:00
Victor Stinner 307745aa42
bpo-43445: Add frozen modules to sys.stdlib_module_names (GH-24798)
Add frozen modules to sys.stdlib_module_names. For example, add
"_frozen_importlib" and "_frozen_importlib_external" names.

Add "list_frozen" command to Programs/_testembed.
2021-03-10 11:14:07 +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
Nicholas Sim 4a6bf276ed
bpo-35134: Move non-limited C API files to Include/cpython/ (GH-24561)
Include/{odictobject.h,parser_interface.h,picklebufobject.h,pydebug.h,pyfpe.h}
into Include/cpython/.

Parser: peg_api: include Python.h instead of parser_interface.h.
2021-02-19 15:55:46 +01:00
Neil Schemenauer ffa55d21b4
bpo-39448: Add regen-frozen makefile target. (GH-18174)
Add the "regen-frozen" makefile target that regenerates the code for the
frozen __hello__ module.
2021-02-18 16:49:12 -08:00
Nicholas Sim 366dc3a135
bpo-35134: Move Include/{pyarena.h,pyctype.h} to Include/cpython/ (GH-24550)
Move non-limited C API headers pyarena.h and pyctype.h
into Include/cpython/ directory.
2021-02-17 19:30:31 +01:00
Victor Stinner 801bb0b503
bpo-43103: Add configure --without-static-libpython (GH-24418)
Add a new configure --without-static-libpython option to not build
the libpythonMAJOR.MINOR.a static library and not install the
python.o object file.

Fix smelly.py and stable_abi.py tools when libpython3.10.a is
missing.
2021-02-17 11:14:42 +01:00
Pablo Galindo 58fb156edd
bpo-42997: Improve error message for missing : before suites (GH-24292)
* Add to the peg generator a new directive ('&&') that allows to expect
  a token and hard fail the parsing if the token is not found. This
  allows to quickly emmit syntax errors for missing tokens.

* Use the new grammar element to hard-fail if the ':' is missing before
  suites.
2021-02-02 19:54:22 +00:00
Victor Stinner 64fc105b2d
bpo-42955: Remove sub-packages from sys.stdlib_module_names (GH-24353) 2021-01-28 00:03:23 +01:00
Victor Stinner 9852cb3811
bpo-42955: Rename module_names to sys.stdlib_module_names (GH-24332)
* Rename _Py_module_names to _Py_stdlib_module_names.
* Rename Python/module_names.h to Python/stdlib_module_names.h.
2021-01-25 23:12:50 +01:00
Victor Stinner db584bdad3
bpo-42955: Add sys.modules_names (GH-24238)
Add sys.module_names, containing the list of the standard library
module names.
2021-01-25 13:24:42 +01:00
Victor Stinner cad8020cb8
bpo-42955: Add Python/module_names.h (GH-24258)
Add a private list of all stdlib modules: _Py_module_names.

* Add Tools/scripts/generate_module_names.py script.
* Makefile: Add "make regen-module-names" command.
* setup.py: Add --list-module-names option.
* GitHub Action and Travis CI also runs "make regen-module-names",
  not ony "make regen-all", to ensure that the module names remains
  up to date.
2021-01-19 23:04:49 +01: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
Steve Dower af4cd16479
Do not remove x bit from published directories (GH-24101) 2021-01-04 20:56:32 +00:00
Pablo Galindo 3bcc4ead3f
Add small validator utility for PEG grammars (GH-23519) 2020-12-26 19:11:29 +00:00
Eric Snow 5ae9be68d9
bpo-36876: [c-analyzer tool] Additional CLI updates for "capi" command. (gh-23929)
https://bugs.python.org/issue36876
2020-12-25 15:57:30 -07:00
Eric Snow 7ec59d8861
bpo-36876: [c-analyzer tool] Add a "capi" subcommand to the c-analyzer tool. (gh-23918)
This will help identify which C-API items will need to be updated for subinterpreter support.

https://bugs.python.org/issue36876
2020-12-24 11:04:19 -07:00
Augusto Hack b57ada98da
closes bpo-42726: gdb libpython: InstanceProxy support for py3 (GH-23912)
On Fedora 31 gdb is using python 3.7.9, calling `proxyval` on an instance with a dictionary fails because of the `dict.iteritems` usage. This PR changes the code to be compatible with py2 and py3.

This changed seemed small enough to not need an issue and news blurb, if one is required please let me know.

Automerge-Triggered-By: GH:benjaminp
2020-12-24 09:16:04 -08:00
Serhiy Storchaka 3d569fd6dc
bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781)
* Tkinter functions and constructors which need a default root window
  raise now RuntimeError with descriptive message instead of obscure
  AttributeError or NameError if it is not created yet or cannot
  be created automatically.

* Add tests for all functions which use default root window.

* Fix import in the pynche script.
2020-12-19 12:17:08 +02:00
Victor Stinner 1c653f17cb
bpo-42613: Fix freeze.py config directory (GH-23792)
Fix freeze.py tool to use the prope config and library directories.
2020-12-16 12:12:36 +01:00
Pablo Galindo 0911411e0c
Update stable ABI script for MacOS and update list of exported symbols (GH-23783) 2020-12-15 18:16:13 +00:00
Pablo Galindo 79c1849b9e
bpo-42545: Improve the error message in the stable API script (GH-23648) 2020-12-04 23:19:21 +00:00
Pablo Galindo 85f1dedb8d
bpo-42545: Check that all symbols in the limited ABI are exported (GH-23616) 2020-12-04 22:05:58 +00:00
Victor Stinner ac7d0169d2
bpo-42212: smelly.py also checks the dynamic library (GH-23423)
The smelly.py script now also checks the Python dynamic library and
extension modules, not only the Python static library. Make also the
script more verbose: explain what it does.

The GitHub Action job now builds Python with the libpython dynamic
library.
2020-11-24 13:38:08 +01:00
Eric Snow 9f02b479e6
bpo-36876: [c-analyzer tool] Tighten up the results and output. (GH-23431)
We also update the "ignored" file with a temporary list of all known globals.
2020-11-20 15:39:28 -07:00
Victor Stinner 8fba9523cf
bpo-42398: Fix "make regen-all" race condition (GH-23362)
Fix a race condition in "make regen-all" when make -jN option is used
to run jobs in parallel. The clinic.py script now only use atomic
write to write files. Moveover, generated files are now left
unchanged if the content does not change, to not change the file
modification time.

The "make regen-all" command runs "make clinic" and "make
regen-importlib" targets:

* "make regen-importlib" builds object files (ex: Modules/_weakref.o)
  from source files (ex: Modules/_weakref.c) and clinic files (ex:
  Modules/clinic/_weakref.c.h)
* "make clinic" always rewrites all clinic files
  (ex: Modules/clinic/_weakref.c.h)

Since there is no dependency between "clinic" and "regen-importlib"
Makefile targets, these two targets can be run in parallel. Moreover,
half of clinic.py file writes are not atomic and so there is a race
condition when "make regen-all" runs jobs in parallel using make -jN
option (which can be passed in MAKEFLAGS environment variable).

Fix clinic.py to make all file writes atomic:

* Add write_file() function to ensure that all file writes are
  atomic: write into a temporary file and then use os.replace().
* Moreover, write_file() doesn't recreate or modify the file if the
  content does not change to avoid modifying the file modification
  file.
* Update test_clinic to verify these assertions with a functional
  test.
* Remove Clinic.force attribute which was no longer used, whereas
  Clinic.verify remains useful.
2020-11-18 15:36:27 +01:00
Steve Dower 9b6934230c
bpo-40754: Adds _testinternalcapi to Windows installer for test suite (GH-23271) 2020-11-13 22:24:36 +00:00
Mark Shannon 877df851c3
bpo-42246: Partial implementation of PEP 626. (GH-23113)
* Implement new line number table format, as defined in PEP 626.
2020-11-12 09:43:29 +00:00
jack1142 bfc6b63102
bpo-36310: Allow pygettext.py to detect calls to gettext in f-strings. (GH-19875)
Adds support to Tools/i18n/pygettext.py for gettext calls in f-strings. This process is done by parsing the f-strings, processing each value, and flagging the ones which contain a gettext call.

Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2020-11-10 01:50:45 +03:00
Yash Shete 1f73c320e2
bpo-41712: Avoid runaway regex match in upload scripts (GH-23166) 2020-11-09 17:38:09 +00:00
Steve Dower db6434c474
Enable signing of nuget.org packages and update to supported timestamp server (GH-23132) 2020-11-03 22:31:49 +00:00
Lysandros Nikolaou 02cdfc93f8
bpo-42218: Correctly handle errors in left-recursive rules (GH-23065)
Left-recursive rules need to check for errors explicitly, since
even if the rule returns NULL, the parsing might continue and lead
to long-distance failures.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-10-31 20:31:41 +02:00
Eric Snow 4fe72090de
bpo-36876: Small adjustments to the C-analyzer tool. (GH-23045)
This is a little bit of clean-up, small fixes, and additional helpers prior to building an updated & accurate list of globals to eliminate.
2020-10-30 15:46:52 -06:00
Victor Stinner b9ee4af4c6
bpo-42208: Fix test_gdb for gc_collect_main() name (GH-23041)
The gcmodule.c collect() function was renamed to gc_collect_main():
update gdb/libpython.py (python-gdb.py).
2020-10-30 21:09:48 +01:00
Victor Stinner c310185c08
bpo-42161: Remove private _PyLong_Zero and _PyLong_One (GH-23003)
Use PyLong_FromLong(0) and PyLong_FromLong(1) of the public C API
instead. For Python internals, _PyLong_GetZero() and _PyLong_GetOne()
of pycore_long.h can be used.
2020-10-27 21:34:33 +01:00
Lysandros Nikolaou bca7014032
bpo-42123: Run the parser two times and only enable invalid rules on the second run (GH-22111)
* Implement running the parser a second time for the errors messages

The first parser run is only responsible for detecting whether
there is a `SyntaxError` or not. If there isn't the AST gets returned.
Otherwise, the parser is run a second time with all the `invalid_*`
rules enabled so that all the customized error messages get produced.
2020-10-27 00:42:04 +02:00
Eric Snow 345cd37abe
bpo-36876: Fix the C analyzer tool. (GH-22841)
The original tool wasn't working right and it was simpler to create a new one, partially re-using some of the old code. At this point the tool runs properly on the master. (Try: ./python Tools/c-analyzer/c-analyzer.py analyze.)  It take ~40 seconds on my machine to analyze the full CPython code base.

Note that we'll need to iron out some OS-specific stuff (e.g. preprocessor). We're okay though since this tool isn't used yet in our workflow. We will also need to verify the analysis results in detail before activating the check in CI, though I'm pretty sure it's close.

https://bugs.python.org/issue36876
2020-10-22 18:42:51 -06:00
Pablo Galindo 47ecfd8030
bpo-41971: Fix test failure in test.test_tools.test_c_analyzer when mutating global state (GH-22652) 2020-10-11 21:34:51 +01:00
Serhiy Storchaka 9975cc5008
bpo-41985: Add _PyLong_FileDescriptor_Converter and AC converter for "fildes". (GH-22620) 2020-10-09 23:00:45 +03:00
Andre Delfino e8a2076e14
Revert "Fix all Python Cookbook links (#22205)" (GH-22424)
This commit reverts commit ac0333e1e1 as the original links are working again and they provide extended features such as comments and alternative versions.
2020-09-27 01:47:25 +01: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
Serhiy Storchaka dcfaa520c4
bpo-41715: Fix potential catastrofic backtracking in c_analyzer. (GH-22091) 2020-09-17 10:34:20 +03:00
Pablo Galindo a5634c4067
bpo-41746: Add type information to asdl_seq objects (GH-22223)
* Add new capability to the PEG parser to type variable assignments. For instance:
```
       | a[asdl_stmt_seq*]=';'.small_stmt+ [';'] NEWLINE { a }
```

* Add new sequence types from the asdl definition (automatically generated)
* Make `asdl_seq` type a generic aliasing pointer type.
* Create a new `asdl_generic_seq` for the generic case using `void*`.
* The old `asdl_seq_GET`/`ast_seq_SET` macros now are typed.
* New `asdl_seq_GET_UNTYPED`/`ast_seq_SET_UNTYPED` macros for dealing with generic sequences.
* Changes all possible `asdl_seq` types to use specific versions everywhere.
2020-09-16 19:42:00 +01:00
Andre Delfino ac0333e1e1
Fix all Python Cookbook links (#22205) 2020-09-15 21:13:26 +01:00
Václav Slavík 7c11a9acca
bpo-41744: Package python.props with correct name in NuGet package (GH-22154)
NuGet automatically includes .props file from the build directory in the
target using the package, but only if the .props file has the correct
name: it must be $(id).props

Rename python.props correspondingly in all the nuspec variants. Also
keep python.props as it were for backward compatibility.
2020-09-14 20:30:15 +01:00
Pablo Galindo e55a0e971b
Fix 'gather' rules in the python parser generator (GH-22021)
Currently, empty sequences in gather rules make the conditional for
gather rules fail as empty sequences evaluate as "False". We need to
explicitly check for "None" (the failure condition) to avoid false
negatives.
2020-09-03 15:29:55 +01:00
Steve Dower 6444ca9469
bpo-41526: Fixed layout of final page of the installer (GH-21871) 2020-08-14 00:35:52 +01:00
Victor Stinner fabd7bb8e0
bpo-41521: Replace whitelist/blacklist with allowlist/denylist (GH-21822)
Automerge-Triggered-By: @tiran
2020-08-11 06:26:59 -07:00
Mark Shannon 582aaf19e8
bpo-41463: Generate information about jumps from 'opcode.py' rather than duplicating it in 'compile.c' (GH-21714)
Generate information about jumps from 'opcode.py' rather than duplicate it in 'compile.c'
2020-08-04 17:30:11 +01:00
Steve Dower 37a06cbe5c
bpo-41412 and bpo-40948: Windows installer updates (GH-21656)
Prevent installation on Windows 8 and earlier.
Download UCRT on demand when required (non-updated Windows 8.1 only)
Add reference to py launcher to post-install message
2020-07-28 16:35:46 +01:00
Lysandros Nikolaou b3fbff7289
bpo-40939: Remove even more references to the old parser (GH-21642)
Automerge-Triggered-By: @lysnikolaou
2020-07-27 12:52:59 -07:00
Guido van Rossum 508ed2d912
Delete remaining references to Grammar/Grammar from docs (#21624)
(Ironically, the file itself remains, see https://github.com/we-like-parsers/cpython/issues/135.)
2020-07-26 08:27:52 -07: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 10772ec150
bpo-41173: Copy test results file from ARM worker before uploading (GH-21305) 2020-07-08 00:24:39 +01:00
Pablo Galindo 1ac0cbca36
bpo-41215: Don't use NULL by default in the PEG parser keyword list (GH-21355)
Automerge-Triggered-By: @lysnikolaou
2020-07-06 12:31:16 -07:00
Serhiy Storchaka b3dd5cd4a3
bpo-36346: Undeprecate private function _PyUnicode_AsUnicode(). (GH-21336) 2020-07-05 18:53:45 +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
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
Lysandros Nikolaou 314858e276
bpo-40939: Remove the old parser (Part 2) (GH-21005)
Remove some remaining files and Makefile targets for the old parser
2020-06-20 19:07:25 +01:00
Batuhan Taskaya 55460ee6dc
bpo-41044: Generate valid PEG python parsers for opt+seq rules (GH-20995)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-06-20 18:40:06 +01:00
Serhiy Storchaka 9355868458
bpo-41043: Escape literal part of the path for glob(). (GH-20994) 2020-06-20 11:10:31 +03:00
Pablo Galindo 5fc4f8ae68
Fix trailing whitespace in keyword.py (GH-20881) 2020-06-15 04:33:33 +01:00
Pablo Galindo 78319e373d
Include soft keywords in keyword.py (GH-20877) 2020-06-15 03:55:15 +01:00
Pablo Galindo 756180b4bf
bpo-40939: Clean and adapt the peg_generator directory after deleting the old parser (GH-20822) 2020-06-12 01:55:35 +01:00
Pablo Galindo 436b648910
bpo-40939: Remove some extra references to PYTHONOLDPARSER (GH-20815)
Automerge-Triggered-By: @pablogsal
2020-06-11 10:08:05 -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
Lysandros Nikolaou 9727694f08
bpo-40939: Generate keyword.py using the new parser (GH-20800) 2020-06-11 13:45:15 +01:00
Lysandros Nikolaou ba6fd87e41
Refactor scripts in Tools/peg_generator/scripts (GH-20401) 2020-06-05 21:21:40 -07:00
Christian Heimes a871f692b4
bpo-30008: Fix OpenSSL no-deprecated compilation (GH-20397)
Fix :mod:`ssl`` code to be compatible with OpenSSL 1.1.x builds that use
``no-deprecated`` and ``--api=1.1.0``.

Note: Tests assume full OpenSSL API and fail with limited API.

Signed-off-by: Christian Heimes <christian@python.org>
Co-authored-by: Mark Wright <gienah@gentoo.org>
2020-06-01 08:58:14 +02:00
Serhiy Storchaka 5f4b229df7
bpo-40792: Make the result of PyNumber_Index() always having exact type int. (GH-20443)
Previously, the result could have been an instance of a subclass of int.

Also revert bpo-26202 and make attributes start, stop and step of the range
object having exact type int.

Add private function _PyNumber_Index() which preserves the old behavior
of PyNumber_Index() for performance to use it in the conversion functions
like PyLong_AsLong().
2020-05-28 10:33:45 +03:00
Pablo Galindo 404b23b85b
Fix lookahead of soft keywords in the PEG parser (GH-20436)
Automerge-Triggered-By: @gvanrossum
2020-05-26 16:15:52 -07:00
Guido van Rossum b45af1a569
Add soft keywords (GH-20370)
These are like keywords but they only work in context; they are not reserved except when there is an exact match.

This would enable things like match statements without reserving `match` (which would be bad for the `re.match()` function and probably lots of other places).

Automerge-Triggered-By: @gvanrossum
2020-05-26 10:58:44 -07: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
Ammar Askar a2bbedc8b1
Fix peg_generator compiler warnings under MSVC (GH-20405) 2020-05-26 05:33:35 +01:00
Lysandros Nikolaou 9645930b5b
bpo-40688: Use the correct parser in the peg_generator scripts (GH-20235)
The scripts in `Tools/peg_generator/scripts` mostly assume that
`ast.parse` and `compile` use the old parser, since this was the
state of things, while we were developing them. They need to be
updated to always use the correct parser. `_peg_parser` is being
extended to support both parsing and compiling with both parsers.
2020-05-25 20:51:58 +01:00
Pablo Galindo deb4355a37
bpo-40750: Do not expand the new parser debug flags if Py_BUILD_CORE is not defined (GH-20393) 2020-05-25 20:17:12 +01:00
Pablo Galindo 800a35c623
bpo-40750: Support -d flag in the new parser (GH-20340) 2020-05-25 18:38:45 +01:00
Batuhan Taskaya cba5031510
bpo-40334: Support suppressing of multiple optional variables in Pegen (GH-20367) 2020-05-24 23:20:18 +01:00
Pablo Galindo b831129123
Fix debug output in PEG parser generator (GH-20308) 2020-05-22 02:48:09 +01:00
Pablo Galindo d10fef35c6
Fix typing problems reported by mypy in pegen (GH-20297) 2020-05-21 21:39:44 +01:00
Batuhan Taskaya f50516e6a9
bpo-40334: Correctly generate C parser when assigned var is None (GH-20296)
When there are 2 negative lookaheads in the same rule, let's say `!"(" blabla "," !")"`, there will the 2 `FunctionCall`'s where assigned value is None. Currently when the `add_var` is called
the first one will be ignored but when the second lookahead's var is sent to dedupe it
will be returned as `None_1` and this won't be ignored by the declaration generator in the `visit_Alt`. This patch adds an explicit check to `add_var` to distinguish whether if there is a variable or not.
2020-05-21 20:57:52 +01:00
Zackery Spytz 8c862e5124
bpo-39631: Fix file association MIME type in the Windows installer (GH-20205)
Use text/x-python instead of text/plain to avoid issues with tools assuming that "ShellExecute(script)" is a non-executable operation.
2020-05-19 13:20:39 +01:00
Pablo Galindo 3764069f3b
bpo-40669: Use requirements.pip when installing PEG dependencies (GH-20194) 2020-05-18 23:37:06 +01:00
Lysandros Nikolaou dc31800f86
bpo-40669: Install PEG benchmarking dependencies in a venv (GH-20183)
Create a `make venv` target, that creates a virtual environment
and installs the dependency in that venv. `make time` and all
the related targets are changed to use the virtual environment
python.

Automerge-Triggered-By: @pablogsal
2020-05-18 11:27:40 -07:00
Lysandros Nikolaou 7b7a21bc4f
bpo-40661: Fix segfault when parsing invalid input (GH-20165)
Fix segfaults when parsing very complex invalid input, like `import äˆ ð£„¯ð¢·žð±‹á”€ð””ð‘©±å®ä±¬ð©¾\n𗶽`.

Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2020-05-18 18:32:03 +01:00
Lysandros Nikolaou 2c8cd06afe
bpo-40334: Improvements to error-handling code in the PEG parser (GH-20003)
The following improvements are implemented in this commit:
- `p->error_indicator` is set, in case malloc or realloc fail.
- Avoid memory leaks in the case that realloc fails.
- Call `PyErr_NoMemory()` instead of `PyErr_Format()`, because it requires no memory.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-05-17 04:19:23 +01:00
Paul Ganssle 62972d9d73
bpo-40503: PEP 615: Tests and implementation for zoneinfo (GH-19909)
This is the initial implementation of PEP 615, the zoneinfo module,
ported from the standalone reference implementation (see
https://www.python.org/dev/peps/pep-0615/#reference-implementation for a
link, which has a more detailed commit history).

This includes (hopefully) all functional elements described in the PEP,
but documentation is found in a separate PR. This includes:

1. A pure python implementation of the ZoneInfo class
2. A C accelerated implementation of the ZoneInfo class
3. Tests with 100% branch coverage for the Python code (though C code
   coverage is less than 100%).
4. A compile-time configuration option on Linux (though not on Windows)

Differences from the reference implementation:

- The module is arranged slightly differently: the accelerated module is
  `_zoneinfo` rather than `zoneinfo._czoneinfo`, which also necessitates
  some changes in the test support function. (Suggested by Victor
  Stinner and Steve Dower.)
- The tests are arranged slightly differently and do not include the
  property tests. The tests live at test/test_zoneinfo/test_zoneinfo.py
  rather than test/test_zoneinfo.py or test/test_zoneinfo/__init__.py
  because we may do some refactoring in the future that would likely
  require this separation anyway; we may:
        - include the property tests
        - automatically run all the tests against both pure Python and C,
          rather than manually constructing C and Python test classes (similar
          to the way this works with test_datetime.py, which generates C
          and Python test cases from datetimetester.py).
- This includes a compile-time configuration option on Linux (though not
  on Windows); added with much help from Thomas Wouters.
- Integration into the CPython build system is obviously different from
  building a standalone zoneinfo module wheel.
- This includes configuration to install the tzdata package as part of
  CI, though only on the coverage jobs. Introducing a PyPI dependency as
  part of the CI build was controversial, and this is seen as less of a
  major change, since the coverage jobs already depend on pip and PyPI.

Additional changes that were introduced as part of this PR, most / all of
which were backported to the reference implementation:

- Fixed reference and memory leaks

    With much debugging help from Pablo Galindo

- Added smoke tests ensuring that the C and Python modules are built

    The import machinery can be somewhat fragile, and the "seamlessly falls
    back to pure Python" nature of this module makes it so that a problem
    building the C extension or a failure to import the pure Python version
    might easily go unnoticed.

- Adjustments to zoneinfo.__dir__

    Suggested by Petr Viktorin.

- Slight refactorings as suggested by Steve Dower.

- Removed unnecessary if check on std_abbr

    Discovered this because of a missing line in branch coverage.
2020-05-16 10:20:06 +02:00
Christian Heimes 6e8cda91d9
bpo-40457: Support OpenSSL without TLS 1.0/1.1 (GH-19862)
OpenSSL can be build without support for TLS 1.0 and 1.1. The ssl module
now correctly adheres to OPENSSL_NO_TLS1 and OPENSSL_NO_TLS1_1 flags.

Also update multissltest to test with latest OpenSSL and LibreSSL
releases.

Signed-off-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: @tiran
2020-05-15 18:33:05 -07:00
Christian Heimes 938717fd04
bpo-40163: Fix multissltest download of old OpenSSL (GH-19329) 2020-05-15 22:32:25 +02:00
Christian Heimes 62d618c06b
bpo-40479: Test with latest OpenSSL versions (GH-20108)
* 1.0.2u (EOL)
* 1.1.0l (EOL)
* 1.1.1g
* 3.0.0-alpha2 (disabled for now)

Build the FIPS provider and create a FIPS configuration file for OpenSSL
3.0.0.

Signed-off-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: @tiran
2020-05-15 09:48:25 -07:00
Victor Stinner 97e1568325
bpo-38787: Fix Argument Clinic defining_class_converter (GH-20074)
Don't hardcode defining_class parameter name to "cls":

* Define CConverter.set_template_dict(): do nothing by default
* CLanguage.render_function() now calls set_template_dict() on all
  converters.
2020-05-14 00:31:31 +02:00
Steve Dower d6b727e2c9
bpo-40501: Replace ctypes code in uuid with native module (GH-19948) 2020-05-12 23:32:32 +01:00
Pablo Galindo ac7a92cc0a
bpo-40334: Avoid collisions between parser variables and grammar variables (GH-19987)
This is for the C generator:
- Disallow rule and variable names starting with `_`
- Rename most local variable names generated by the parser to start with `_`

Exceptions:
- Renaming `p` to `_p` will be a separate PR
- There are still some names that might clash, e.g.
  - anything starting with `Py`
  - C reserved words (`if` etc.)
  - Macros like `EXTRA` and `CHECK`
2020-05-09 21:34:50 -07:00
Pablo Galindo db9163ceef
bpo-40555: Check for p->error_indicator in loop rules after the main loop is done (GH-19986) 2020-05-08 03:38:44 +01:00
Petr Viktorin e1becf46b4
bpo-38787: C API for module state access from extension methods (PEP 573) (GH-19936)
Module C state is now accessible from C-defined heap type methods (PEP 573).
Patch by Marcel Plch and Petr Viktorin.

Co-authored-by: Marcel Plch <mplch@redhat.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2020-05-07 15:39:59 +02:00
Pablo Galindo 470aac4d8e
bpo-40334: Generate comments in the parser code to improve debugging (GH-19966) 2020-05-06 23:14:43 +01:00
Anthony Shaw c95e691c90
Clean up unused imports for the peg generator module (GH-19891) 2020-05-04 03:03:05 +01:00
Pablo Galindo d2baff4301
bpo-40334: regenerate metaparser as part of regen-all (GH-19854) 2020-05-02 05:23:39 +01:00
Pablo Galindo 9dbaa8d9f0
Fix some scripts in the peg generator folder (GH-19853) 2020-05-02 05:23:06 +01:00
Pablo Galindo 7ba08ff7b4
bpo-40334: use the TOKENS file when checking dangling rules (GH-19849) 2020-05-01 23:14:12 +01:00
Pablo Galindo 6bd99d5f00
Fix the Tools/peg_generator/scripts/benchmark.py script (GH-19848) 2020-05-01 22:33:54 +01:00
Pablo Galindo b796b3fb48
bpo-40334: Simplify type handling in the PEG c_generator (GH-19818) 2020-05-01 12:32:26 +01:00
Dong-hee Na 113feb3ec2
bpo-40328: Add tool for generating cjk mapping headers (GH-19602) 2020-04-30 02:34:24 +09:00
Pablo Galindo 4db245ee9d
bpo-40334: refactor and cleanup for the PEG generators (GH-19775) 2020-04-29 10:42:21 +01:00
Pablo Galindo 5b9f4988c9
bpo-40334: Refactor peg_generator to receive a Tokens file when building c code (GH-19745) 2020-04-28 13:11:55 +01:00
Pablo Galindo 2b74c835a7
bpo-40334: Support CO_FUTURE_BARRY_AS_BDFL in the new parser (GH-19721)
This commit also allows to pass flags to the new parser in all interfaces and fixes a bug in the parser generator that was causing to inline rules with actions, making them disappear.
2020-04-27 18:02:07 +01:00
Ammar Askar f82807746d
closes bpo-40385: Remove Tools/scripts/checkpyc.py (GH-19709)
This is one of the few files that has intimate knowledge of the pyc file
format. Since it lacks tests it tends to become outdated fairly quickly.
At present it has been broken since the introduction of PEP 552.
2020-04-24 23:33:59 -05:00
Lysandros Nikolaou 24ffe705c3
bpo-40334: Rewrite test_c_parser to avoid memory leaks (GH-19694)
Previously every test was building an extension module and
loading it into sys.modules. The tearDown function was thus
not able to clean up correctly, resulting in memory leaks.

With this commit, every test function now builds the extension
module and runs the actual test code in a new process
(using assert_python_ok), so that sys.modules stays intact
and no memory gets leaked.
2020-04-24 14:51:09 +01:00
Pablo Galindo 50f28dea32
bpo-40334: Allow to run make regen-pegen without distutils (GH-19684) 2020-04-24 00:53:29 +01:00
Pablo Galindo 9e6a1312c1
bpo-40370: Use the same compile and link args as the interpreter used in test_peg_generator (GH-19674) 2020-04-23 14:46:22 +01:00
Pablo Galindo 1df5a9e88c
bpo-40334: Fix build errors and warnings in test_peg_generator (GH-19672) 2020-04-23 12:42:13 +01:00
Pablo Galindo 0b7829e089
Compile extensions in test_peg_generator with C99 (GH-19668) 2020-04-23 03:24:25 +01: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
Serhiy Storchaka 12446e6a60
bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364)
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
2020-04-18 17:52:48 +03:00
Lysandros Nikolaou 9a4b38f66b
bpo-40267: Fix message when last input character produces a SyntaxError (GH-19521)
When there is a SyntaxError after reading the last input character from
the tokenizer and if no newline follows it, the error message used to be
`unexpected EOF while parsing`, which is wrong.
2020-04-15 11:22:10 -07:00
Benjamin Peterson 584a3cfda4
closes bpo-40266, closes bpo-39953: Use numeric lib code if compiling against old OpenSSL. (GH-19506) 2020-04-13 22:11:40 -05:00
Benjamin Peterson 909b87d2bb
closes bpo-39953: Generate ifdefs around library code definitions. (GH-19490) 2020-04-12 13:59:31 -05:00
Benjamin Peterson 3e0dd3730b
closes bpo-39953: Update OpenSSL error codes table. (GH-19082)
I updated the error codes using the OpenSSL 1.1.1f source tree.
2020-04-11 15:36:12 -05:00
Victor Stinner e7c98f08e2
bpo-40094: Fix which.py script exit code (GH-19286)
It now uses os.waitstatus_to_exitcode() to convert os.system() exit
status into an exit code.
2020-04-02 03:42:47 +02:00
Benjamin Peterson cd16661f90
closes bpo-40125: Update multissltests.py to use OpenSSL 1.1.1f. (GH-19248) 2020-03-31 10:49:56 -05:00
Victor Stinner 7bf069b611
bpo-40019: Skip test_gdb if Python was optimized (GH-19081)
test_gdb now skips tests if it detects that gdb failed to read debug
information because the Python binary is optimized.
2020-03-20 08:23:26 +01:00
Steve Dower 2dd41740c9
bpo-39930: Ensure vcruntime140.dll is included in all Windows packages (GH-18918)
Also adds GitHub CI test for Windows installer changes
2020-03-11 11:18:12 +00:00
Benjamin Peterson 51796e5d26
Update some www.unicode.org URLs to use HTTPS. (GH-18912) 2020-03-10 21:10:59 -07:00
Benjamin Peterson 051b9d08d1
closes bpo-39926: Update Unicode to 13.0.0. (GH-18910) 2020-03-10 20:41:34 -07:00
Victor Stinner 6d0ee60740
bpo-36184: Port python-gdb.py to FreeBSD (GH-18873)
python-gdb.py now checks for "take_gil" function name to check if a
frame tries to acquire the GIL, instead of checking for
"pthread_cond_timedwait" which is specific to Linux and can be a
different condition than the GIL.
2020-03-09 19:35:26 +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
Dong-hee Na 9aeb0ef930
bpo-39573: Update clinic to use Py_IS_TYPE() function (GH-18507) 2020-02-14 08:50:19 +01: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
Dong-hee Na 5136e721d7 argument-clinic: Simplify multi-line string handling (GH-17852) 2020-01-06 10:46:03 +00:00
Anthony Shaw 78018bb162 Remove outdated mention of hg.exe from Tools/msi/README.txt (GH-17792) 2020-01-02 11:32:55 -06:00
Pablo Galindo 27fc3b6f3f
bpo-38870: Expose a function to unparse an ast object in the ast module (GH-17302)
Add ast.unparse() as a function in the ast module that can be used to unparse an
ast.AST object and produce a string with code that would produce an equivalent ast.AST
object when parsed.
2019-11-24 23:02:40 +00:00
Adam Johnson 892221bfa0 bpo-38839: Fix some unused functions in tests (GH-17189) 2019-11-19 11:45:20 -08:00
Victor Stinner ae7aa42774
Remove code commented for more than 10 years (GH-16965)
test_urllib commented since 2007:

commit d9880d07fc
Author: Facundo Batista <facundobatista@gmail.com>
Date:   Fri May 25 04:20:22 2007 +0000

    Commenting out the tests until find out who can test them in
    one of the problematic enviroments.

pynche code commented since 1998 and 2001:

commit ef30092207
Author: Barry Warsaw <barry@python.org>
Date:   Tue Dec 15 01:04:38 1998 +0000

    Added most of the mechanism to change the strips from color variations
    to color constants (i.e. red constant, green constant, blue
    constant).  But I haven't hooked this up yet because the UI gets more
    crowded and the arrows don't reflect the correct values.

    Added "Go to Black" and "Go to White" buttons.

commit 741eae0b31
Author: Barry Warsaw <barry@python.org>
Date:   Wed Apr 18 03:51:55 2001 +0000

    StripWidget.__init__(), update_yourself(): Removed some unused local
    variables reported by PyChecker.

    __togglegentype(): PyChecker accurately reported that the variable
    __gentypevar was unused -- actually this whole method is currently
    unused so comment it out.
2019-10-28 22:35:31 +01:00
Steve Dower 0ac6137dd3
bpo-38589: Fixes HTML Help shortcut when Windows is not installed to C drive (GH-16968) 2019-10-28 14:34:25 -07:00
benedwards14 794616f837 bpo-38534: Replace wrong KB number references (GH-16955) 2019-10-28 10:53:51 -07:00
Raymond Hettinger ea6041cd7f
bpo-38539: Finish rename of ss1.py to spreadsheet.py (GH-16896) 2019-10-22 21:05:02 -07:00
Julin S a4aeb33669 bpo-38539: Update demo files (GH-16890) 2019-10-22 20:23:48 -07:00
AMIR 20bf8e08a1 bpo-38419: fix "check-c-globals" path (GH-16680) 2019-10-22 21:05:54 -03:00
Sergey Fedoseev a9ed91e6c2 bpo-27961: Replace PY_LONG_LONG with long long. (GH-15386) 2019-10-21 09:49:48 +03:00
Eric Snow e4c431ecf5
bpo-36876: Re-organize the c-analyzer tool code. (gh-16841)
This is partly a cleanup of the code. It also is preparation for getting the variables from the source (cross-platform) rather than from the symbols.

The change only touches the tool (and its tests).
2019-10-18 19:00:04 -07:00
Ruediger Pluem 2b7dc40b2a bpo-38347: find pathfix for Python scripts whose name contain a '-' (GH-16536)
pathfix.py: Assume all files that end on '.py' are Python scripts when working recursively.
2019-10-11 15:36:50 +02:00
Eric Snow 6693f730e0
bpo-38187: Fix a refleak in Tools/c-analyzer. (gh-16304)
The "Slot" helper (descriptor) is leaking references due to its caching mechanism. The change includes a partial fix to Slot, but also adds Variable.storage to replace the problematic use of Slot.

https://bugs.python.org/issue38187
2019-09-27 15:53:34 +01:00
PatrikKopkan 1dc1acbd73 bpo-37064: Add option -a to pathfix.py tool (GH-15717)
Add option -a to Tools/Scripts/pathfix.py script: add flags.
2019-09-25 14:26:28 +02:00
Marc Hartmayer 6f53d34fb0 closes bpo-16637: libpython: construct integer object directly from gdbvalue (GH-15232)
This fixes the exception '`ValueError: invalid literal for int() with base 10`
if `str(gdbval)` returns a hexadecimal value (e.g. '0xa0'). This is the case if
the output-radix is set to 16 in gdb. See
https://sourceware.org/gdb/onlinedocs/gdb/Numbers.html for more information.
2019-09-23 20:34:12 -07:00
Pablo Galindo 6fbc924696
bpo-38187: Fix reference leak in test_tools (GH-16233) 2019-09-17 17:04:46 +01:00
Serhiy Storchaka 279f44678c
bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933)
In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values
(like in the optional third parameter of getattr). "None" should be used if None is accepted
as argument and passing None has the same effect as not passing the argument at all.
2019-09-14 12:24:05 +03:00
Benjamin Peterson a44f3dc21d
Move Eric's TODO file into his directory. (GH-16072) 2019-09-12 18:19:46 +01:00
Eric Snow 088b63ea7a
bpo-36876: Fix the globals checker tool. (gh-16058) 2019-09-12 16:59:38 +01:00
Greg Price a65678c5c9 bpo-37760: Convert from length-18 lists to a dataclass, in makeunicodedata. (GH-15265)
Now the fields have names!  Much easier to keep straight as a
reader than the elements of an 18-tuple.

Runs about 10-15% slower: from 10.8s to 12.3s, on my laptop.
Fortunately that's perfectly fine for this maintenance script.
2019-09-12 10:23:43 +01:00
Eric Snow ee536b2020
bpo-36876: Add a tool that identifies unsupported global C variables. (#15877) 2019-09-11 19:49:45 +01:00
Christian Heimes 58ab13479d bpo-38117: Test with OpenSSL 1.1.1d (GH-15983)
Signed-off-by: Christian Heimes <christian@python.org>
2019-09-11 18:45:52 +02:00
Jeroen Demeyer 7a6873cdb1 bpo-37151: remove special case for PyCFunction from PyObject_Call (GH-14684)
bpo-37151: remove special case for PyCFunction from PyObject_Call

Alse, make the undocumented function PyCFunction_Call an alias
of PyObject_Call and deprecate it.
2019-09-11 12:01:01 +01:00
Paul Monson 55d12ce8b8 bpo-36511: clean up python process before deploy on ARM Windows buildbots (GH-14431) 2019-09-09 22:11:17 +01:00
Greg Price 3cbc23aa22 bpo-37758: Cut always-constant conditionals on sys.maxunicode. (GH-15302)
Since PEP 393 in Python 3.3, this value is always 0x10ffff, the
maximum codepoint in Unicode; there's no longer such a thing as a
UCS-2 build of Python, which couldn't properly represent some
characters.

There are a couple of spots left where we still condition on the value
of this constant.  Take them out.
2019-09-09 08:20:40 -07:00
Greg Price fa3a38d81f Mark files as executable that are meant as scripts. (GH-15354)
This is the converse of GH-15353 -- in addition to plenty of
scripts in the tree that are marked with the executable bit
(and so can be directly executed), there are a few that have
a leading `#!` which could let them be executed, but it doesn't
do anything because they don't have the executable bit set.

Here's a command which finds such files and marks them.  The
first line finds files in the tree with a `#!` line *anywhere*;
the next-to-last step checks that the *first* line is actually of
that form.  In between we filter out files that already have the
bit set, and some files that are meant as fragments to be
consumed by one or another kind of preprocessor.

    $ git grep -l '^#!' \
      | grep -vxFf <( \
          git ls-files --stage \
          | perl -lane 'print $F[3] if (!/^100644/)' \
        ) \
      | grep -ve '\.in$' -e '^Doc/includes/' \
      | while read f; do
          head -c2 "$f" | grep -qxF '#!' \
          && chmod a+x "$f"; \
        done
2019-09-09 07:16:33 -07:00
Steve Dower 3a0ddbcdfc
bpo-37283: Ensure command-line and unattend.xml setting override previously detected states in Windows installer (GH-15759) 2019-09-09 05:15:07 -07:00
PatrikKopkan 50254ac4c1 bpo-37064: Add option -k to Tools/scripts/pathfix.py (GH-15548)
Add flag -k to pathscript.py script: preserve shebang flags.
2019-09-05 16:54:54 +02: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
Raymond Hettinger 0dac68f1e5
bpo-36743: __get__ is sometimes called without the owner argument (#12992) 2019-08-29 01:27:42 -07:00
Raymond Hettinger aef9ad82f7
bpo-37942: Improve argument clinic float converter (GH-15470) 2019-08-24 19:10:39 -07:00
Greg Price 3e4498d35c bpo-37760: Avoid cluttering work tree with downloaded Unicode files. (GH-15128) 2019-08-14 18:18:53 -07:00
Greg Price c03e698c34 bpo-37760: Factor out standard range-expanding logic in makeunicodedata. (GH-15248)
Much like the lower-level logic in commit ef2af1ad4, we had
4 copies of this logic, written in a couple of different ways.
They're all implementing the same standard, so write it just once.
2019-08-13 19:28:38 -07:00
Greg Price 99d208efed bpo-37760: Constant-fold some old options in makeunicodedata. (GH-15129)
The `expand` option was introduced in 2000 in commit fad27aee1.
It appears to have been always set since it was committed, and
what it does is tell the code to do something essential.  So,
just always do that, and cut the option.

Also cut the `linebreakprops` option, which isn't consulted anymore.
2019-08-12 22:59:30 -07:00
Greg Price ef2af1ad44 bpo-37760: Factor out the basic UCD parsing logic of makeunicodedata. (GH-15130)
There were 10 copies of this, and almost as many distinct versions of
exactly how it was written.  They're all implementing the same
standard.  Pull them out to the top, so the more interesting logic
that remains becomes easier to read.
2019-08-12 22:20:56 -07:00
Paul Monson ed70a344b5 bpo-36511: Fix failures in Windows ARM32 buildbot (GH-15181) 2019-08-08 16:12:33 -07:00
Serhiy Storchaka 662db125cd
bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)
They now return NotImplemented for unsupported type of the other operand.
2019-08-08 08:42:54 +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
Victor Stinner 27eeaf0f2c
bpo-37704: Remove Tools/scripts/h2py.py (GH-15000)
Use cffi to access a C API in Python.
2019-07-30 17:45:09 +02:00
Steve Dower fe330fc4ad
Fix publishing of Windows release (GH-15006) 2019-07-29 11:22:27 -07:00
Steve Dower 994a3b88dc
Enable publish of Windows releases through Azure Pipelines (GH-14720) 2019-07-13 11:46:16 +02:00
Jeroen Demeyer 0d722f3cd6 bpo-36974: separate vectorcall functions for each calling convention (GH-13781) 2019-07-05 14:48:24 +02:00
Victor Stinner 36456df138
bpo-37392: Remove sys.setcheckinterval() (GH-14355)
Remove sys.getcheckinterval() and sys.setcheckinterval() functions.
They were deprecated since Python 3.2. Use sys.getswitchinterval()
and sys.setswitchinterval() instead.

Remove also check_interval field of the PyInterpreterState structure.
2019-06-25 03:01:08 +02:00
Steve Dower f5690925df bpo-37351: Removes libpython38.a from standard Windows distribution (#14276) 2019-06-21 14:28:46 -07:00
Paul Monson f8dd77d360 bpo-36511: Fix -u parameters for ARM32 tests (GH-14280) 2019-06-21 09:40:05 -07:00
Paul Monson a1952122a3 bpo-36511: Improve ARM32 buildbot scripts (GH-14251) 2019-06-20 09:33:32 -07:00
Jeroen Demeyer 7e1a9aacff bpo-37151: remove _PyCFunction_FastCallDict (GH-14269) 2019-06-21 00:38:45 +09:00
Paul Monson f355069a33 bpo-36511: Add buildbot scripts and fix tests for Windows ARM32 buildbot (GH-13454) 2019-06-19 13:09:54 -07:00
Steve Dower 749e73065d
Fix Windows release build issues (GH-14091)
* Increase timeout for PGO builds in Windows release
* Fix test step failures
* Disable MinGW step properly
* Fix embeddable distro name
2019-06-14 14:19:25 -07:00
Steve Dower 21a92f8cda
Implement Windows release builds in Azure Pipelines (GH-14065) 2019-06-14 08:29:20 -07:00
Paul Monson e7e5039d69 bpo-37181: Fix test_regrtest failures on Windows arm64 (GH-13872) 2019-06-07 10:58:41 -07:00
Steve Dower e0c0c7e8c9
bpo-37156: Fix libssl DLL tag in MSI sources (GH-13866) 2019-06-06 09:06:51 -07:00
Christian Heimes e35d1ba9ea
bpo-34271: Fix compatibility with 1.0.2 (GH-13728)
Fix various compatibility issues with LibreSSL and OpenSSL 1.0.2
introduced by bpo-34271.

Signed-off-by: Christian Heimes <christian@python.org>
2019-06-03 20:40:15 +02:00
Christian Heimes 06651ee418
bpo-37081: Test with OpenSSL 1.1.1c (GH-13631)
Signed-off-by: Christian Heimes <christian@python.org>
2019-06-03 20:10:19 +02:00
Tim Hoffmann 5df4025f42 Add description to the command line help of the argument clinic (GH-8518) 2019-06-02 17:58:10 +01:00
Stefan Behnel faa2948654
Clean up and reduce visual clutter in the makeunicode.py script. (GH-7558) 2019-06-01 21:49:03 +02:00
Jeroen Demeyer 37788bc23f bpo-36974: rename _FastCallKeywords -> _Vectorcall (GH-13653) 2019-05-30 15:11:22 +02:00
Petr Viktorin fecb75c1bb
bpo-36974: Fix GDB integration (GH-13665)
As it changes the way functions are called, the PEP 590 implementation
skipped the functions that the GDB integration is looking for
(by name) to find function calls.

Looking for the new helper `cfunction_call_varargs` hopefully fixes the
tests, and thus buildbots.

The changed frame nuber in test_gdb is due to there being fewer
C calls when calling a built-in method.
2019-05-29 22:45:41 +02:00
Chih-Hsuan Yen aaf47caf35 bpo-37053: handle strings like u"bar" correctly in Tools/parser/unparse.py (GH-13583)
Constant.kind is added in https://bugs.python.org/issue36280.
Current possible values for Constant.kind are "u" or None.

For r'bar' and b'bar', Constant.kind value is None, so there's no need
for special handling.


https://bugs.python.org/issue37053
2019-05-26 10:08:19 -07:00
Paul Monson 51394b8c3d bpo-36511: Ensure error code propagates out of batch files (GH-13529) 2019-05-24 09:15:39 -07:00
Paul Monson 4f820723c8 bpo-36511: Windows arm32 buildbot changes (remove extra space) (GH-13351)
@zooba
I just realized that this whitespace fix didn't get pushed.


https://bugs.python.org/issue36511
2019-05-15 16:10:39 -07:00
Paul Monson 67ff6a103a bpo-36511: Windows ARM32 buildbot changes (GH-12917) 2019-05-15 15:42:29 -07:00
Benjamin Peterson 3aca40d3cb
closes bpo-36861: Update Unicode database to 12.1.0. (GH-13214)
Adds ㋿.
2019-05-08 20:59:35 -07:00
Zackery Spytz c4e78b116f bpo-14546: Fix the argument handling in Tools/scripts/lll.py (GH-13026) 2019-05-02 18:03:43 +03:00
Pablo Galindo 8c77b8cb91
bpo-36540: PEP 570 -- Implementation (GH-12701)
This commit contains the implementation of PEP570: Python positional-only parameters.

* Update Grammar/Grammar with new typedarglist and varargslist

* Regenerate grammar files

* Update and regenerate AST related files

* Update code object

* Update marshal.c

* Update compiler and symtable

* Regenerate importlib files

* Update callable objects

* Implement positional-only args logic in ceval.c

* Regenerate frozen data

* Update standard library to account for positional-only args

* Add test file for positional-only args

* Update other test files to account for positional-only args

* Add News entry

* Update inspect module and related tests
2019-04-29 13:36:57 +01:00
周家未 d59b662e49 bpo-36690: Fix typo in Tools/demo/rpython.py (GH-12903) 2019-04-22 16:28:57 +03:00
Inada Naoki 6fec905de5
bpo-36642: make unicodedata const (GH-12855) 2019-04-17 08:40:34 +09:00
Stéphane Wirtel 2b7f93b99a
bpo-36345: Update wsgiref example (GH-12562)
Use literalinclude markup to include Tools/scripts/serve.py code.
Tools/scripts/serve.py first argument on the command line is now optional.
2019-04-16 14:52:54 +02:00
Steve Dower 606c66a17f
Allow Windows layout builds to fully skip code signing (GH-12808) 2019-04-12 11:24:15 -07:00
Paul Monson aa25d5d026 Enable building nuget packages for ARM32 (GH-12669) 2019-04-12 09:36:38 -07:00
Anthony Sottile 2a4ce4387f Tools/importbench: Fix a misplaced stderr= (GH-12690) 2019-04-05 09:18:19 +02:00
Steve Dower 79da388a40
bpo-36085: Add installer check for KB2533625 (GH-12636) 2019-03-30 20:58:17 -07:00
Paul Moore e724152796 bpo-36010: Add venv to the nuget distribution (GH-12367) 2019-03-30 09:32:05 -07:00
Serhiy Storchaka 172bb39452
bpo-22831: Use "with" to avoid possible fd leaks in tools (part 2). (GH-10927) 2019-03-30 08:33:02 +02:00
Serhiy Storchaka afbb7a371f
bpo-22831: Use "with" to avoid possible fd leaks in tools (part 1). (GH-10926) 2019-03-30 08:32:18 +02:00
Paul Monson 32119e10b7 bpo-35947: Update Windows to the current version of libffi (GH-11797)
We now use a pre-built libffi binary from our binaries repository, and no longer vendor the full implementation.
2019-03-29 16:30:10 -07:00
Steve Dower 4a9a505d6f
bpo-36441: Fixes creating a venv when debug binaries are installed. (#12566) 2019-03-27 08:14:53 -07:00
Stefan Behnel 68d228f174 bpo-35884: Add string-keys-only microbenchmark for dict access to var_access_benchmark.py (GH-11905) 2019-03-25 01:20:53 -07:00
AraHaan a7987e7193 bpo-32217: Correct usage of ABI tags in freeze. (GH-4719)
Check for sys.abiflags before using since not all platforms have it defined.
2019-03-23 12:29:49 -04:00
Serhiy Storchaka 3191391515
bpo-36127: Argument Clinic: inline parsing code for keyword parameters. (GH-12058) 2019-03-14 10:32:22 +02:00
Steve Dower 26c910c59c
bpo-36174: Update nuget authoring for new license field. (GH-12300) 2019-03-12 16:48:17 -07:00
Lisa Roach 1ceb3a3d17
bpo-35132: Fixes missing target in gdb pep0393 check. (GH-11848) 2019-03-11 20:21:25 -07:00
Benjamin Peterson 738c19f4c5
closes bpo-33376: Update to Unicode 12.0.0. (GH-12256) 2019-03-09 16:25:55 -08:00
Serhiy Storchaka 6a44f6eef3
bpo-36048: Use __index__() instead of __int__() for implicit conversion if available. (GH-11952)
Deprecate using the __int__() method in implicit conversions of Python
numbers to C integers.
2019-02-25 17:57:58 +02:00
animalize 463572c8be bpo-36101: remove non-ascii characters in docstring (GH-12018)
* remove non-ascii characters in docstring
* clinic.py emits a warning when docstring has non-ascii character
2019-02-25 08:18:48 +09:00
Raymond Hettinger 43766f82dd bpo-35884: Add missing FIFO queue benchmark (GH-11898)
https://bugs.python.org/issue35884
2019-02-16 12:51:02 -08:00
Raymond Hettinger 9da3583e78 Fix typo (micro->nano) (GH-11759) 2019-02-04 23:32:55 -08:00
Steve Dower 85e102a2b0
bpo-35299: Fixed sysconfig and distutils during PGO profiling (GH-11744) 2019-02-04 17:15:13 -08:00
Raymond Hettinger f75d59e1a8
bpo-35884: Add variable access benchmarking script (GH-11725) 2019-02-02 22:54:56 -08:00
Steve Dower 4c70d9f79c
bpo-34691: Compile _contextvars module into main Python library (GH-11741) 2019-02-02 14:36:23 -08:00
Victor Stinner 1396d8fab4
bpo-35224: Add support for NamedExpr to unparse.py (GH-11670) 2019-01-25 01:49:53 +01:00
Serhiy Storchaka 2a39d251f0
bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (GH-11520)
Use _PyArg_CheckPositional() and inlined code instead of
PyArg_UnpackTuple() and _PyArg_UnpackStack() if all parameters
are positional and use the "object" converter.
2019-01-11 18:01:42 +02:00
Serhiy Storchaka 4fa9591025
bpo-35582: Argument Clinic: inline parsing code for positional parameters. (GH-11313) 2019-01-11 16:01:14 +02:00
Serhiy Storchaka 32d96a2b5b
bpo-23867: Argument Clinic: inline parsing code for a single positional parameter. (GH-9689) 2018-12-25 13:23:47 +02:00
Serhiy Storchaka 65ce60aef1
bpo-20180: Simplify char_converter in Argument Clinic. (GH-9828)
Fix also handling non-ascii default values.
2018-12-25 11:10:05 +02:00
Serhiy Storchaka 8ac658114d
bpo-30455: Generate all token related code and docs from Grammar/Tokens. (GH-10370)
"Include/token.h", "Lib/token.py" (containing now some data moved from
"Lib/tokenize.py") and new files "Parser/token.c" (containing the code
moved from "Parser/tokenizer.c") and "Doc/library/token-list.inc" (included
in "Doc/library/token.rst") are now generated from "Grammar/Tokens" by
"Tools/scripts/generate_token.py". The script overwrites files only if
needed and can be used on the read-only sources tree.

"Lib/symbol.py" is now generated by "Tools/scripts/generate_symbol_py.py"
instead of been executable itself.

Added new make targets "regen-token" and "regen-symbol" which are now
dependencies of "regen-all".

The documentation contains now strings for operators and punctuation tokens.
2018-12-22 11:18:40 +02:00
Steve Dower d3bbc52413
Enable signing Windows builds with SHA1 environment variable (GH-11279) 2018-12-21 13:48:18 -08:00
Serhiy Storchaka 4db62e1158
bpo-35490: Remove the DecodeFSDefault return converter in AC. (#11152) 2018-12-17 16:47:45 +02:00
Victor Stinner d7538dd5e3
bpo-35471: Remove the macpath module (GH-11129)
Python 2.4 dropped MacOS 9 support. The macpath module was deprecated
in Python 3.7. This change removes it.
2018-12-14 13:37:26 +01:00
Serhiy Storchaka afb3e71a17
bpo-35489: Use "const Py_UNICODE *" for the Py_UNICODE converter in AC. (GH-11150) 2018-12-14 11:19:51 +02:00
Steve Dower 0cd6391fd8
bpo-34977: Add Windows App Store package (GH-11027)
Also adds the PC/layout script for generating layouts on Windows.
2018-12-10 18:52:57 -08:00
Steve Dower 1c3de541e6
bpo-34977: Use venv redirector instead of original python.exe on Windows (GH-11029) 2018-12-10 08:11:21 -08:00
Victor Stinner cb0b78a070
Revert "bpo-34977: Add Windows App Store package (GH-10245)" (GH-11019)
This reverts commit 468a15aaf9.
2018-12-07 12:57:43 +01:00
Steve Dower 468a15aaf9
bpo-34977: Add Windows App Store package (GH-10245) 2018-12-06 21:09:20 -08:00
Serhiy Storchaka 4a934d490f
bpo-33012: Fix invalid function cast warnings with gcc 8 in Argument Clinic. (GH-6748)
Fix invalid function cast warnings with gcc 8
for method conventions different from METH_NOARGS, METH_O and
METH_VARARGS in Argument Clinic generated code.
2018-11-27 11:27:36 +02:00
Victor Stinner e421106b9e
bpo-35134: Create Include/cpython/ subdirectory (GH-10624)
Include/*.h should be the "portable Python API", whereas
Include/cpython/*.h should be the "CPython API": CPython
implementation details.

Changes:

* Create Include/cpython/ subdirectory
* "make install" now creates $prefix/include/cpython and copy
  Include/cpython/* to $prefix/include/cpython
* Create Include/cpython/objimpl.h: move objimpl.h code
  surrounded by "#ifndef Py_LIMITED_API" to cpython/objimpl.h.
* objimpl.h now includes cpython/objimpl.h
* Windows installer (MSI) now also install Include/ subdirectories:
  Include/cpython/ and Include/internal/.
2018-11-23 17:00:00 +01:00
Cheryl Sabella 637a33b996 bpo-2504: Add pgettext() and variants to gettext. (GH-7253) 2018-11-07 16:12:20 +02:00
Serhiy Storchaka 34fd4c2019
bpo-35133: Fix mistakes when concatenate string literals on different lines. (GH-10284)
Two kind of mistakes:

1. Missed space. After concatenating there is no space between words.

2. Missed comma. Causes unintentional concatenating in a list of strings.
2018-11-05 16:20:25 +02:00
Steve Dower 53125a53f4
bpo-35067: Remove _distutils_findvs and use vswhere.exe instead. (GH-10095) 2018-10-27 16:48:33 -04:00
Alexey Izbyshev aa95bfb5fe bpo-32256: Make patchcheck.py work for out-of-tree builds (GH-4760)
Set SRCDIR as the current directory for git.
2018-10-20 02:49:41 +02:00
Shivank98 e3d1455fe4 Update opcode.h header comment to mention the source data file (GH-9935)
This is intended to help code explorers find out more about what's defined there.
2018-10-18 14:53:18 -05:00
Victor Stinner 2e438cc255
bpo-34989: python-gdb.py: fix current_line_num() (GH-9889)
python-gdb.py now handles errors on computing the line number
of a Python frame.

Changes:

* PyFrameObjectPtr.current_line_num() now catchs any Exception on
  calling addr2line(), instead of failing with a surprising "<class
  'TypeError'> 'FakeRepr' object is not subscriptable" error.
* All callers of current_line_num() now handle current_line_num()
  returning None.
* PyFrameObjectPtr.current_line() now also catchs IndexError on
  getting a line from the Python source file.
2018-10-15 23:19:57 +02:00