Skip to content

Commit b8ab90f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into super_call
2 parents ccbb515 + 148bc05 commit b8ab90f

26 files changed

+5518
-7568
lines changed

Doc/data/stable_abi.dat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ Py_SetPath
776776
Py_SetProgramName
777777
Py_SetPythonHome
778778
Py_SetRecursionLimit
779-
Py_SymtableString
780779
Py_UTF8Mode
781780
Py_VaBuildValue
782781
Py_XNewRef

Doc/using/unix.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,53 @@ some Unices may not have the :program:`env` command, so you may need to hardcode
134134
``/usr/bin/python3`` as the interpreter path.
135135

136136
To use shell commands in your Python scripts, look at the :mod:`subprocess` module.
137+
138+
139+
Custom OpenSSL
140+
==============
141+
142+
1. To use your vendor's OpenSSL configuration and system trust store, locate
143+
the directory with ``openssl.cnf`` file or symlink in ``/etc``. On most
144+
distribution the file is either in ``/etc/ssl`` or ``/etc/pki/tls``. The
145+
directory should also contain a ``cert.pem`` file and/or a ``certs``
146+
directory.
147+
148+
.. code-block:: shell-session
149+
150+
$ find /etc/ -name openssl.cnf -printf "%h\n"
151+
/etc/ssl
152+
153+
2. Download, build, and install OpenSSL. Make sure you use ``install_sw`` and
154+
not ``install``. The ``install_sw`` target does not override
155+
``openssl.cnf``.
156+
157+
.. code-block:: shell-session
158+
159+
$ curl -O https://www.openssl.org/source/openssl-VERSION.tar.gz
160+
$ tar xzf openssl-VERSION
161+
$ pushd openssl-VERSION
162+
$ ./config \
163+
--prefix=/usr/local/custom-openssl \
164+
--openssldir=/etc/ssl
165+
$ make -j1 depend
166+
$ make -j8
167+
$ make install_sw
168+
$ popd
169+
170+
3. Build Python with custom OpenSSL
171+
172+
.. code-block:: shell-session
173+
174+
$ pushd python-3.x.x
175+
$ ./configure -C \
176+
--with-openssl=/usr/local/custom-openssl \
177+
--with-openssl-rpath=auto \
178+
--prefix=/usr/local/python-3.x.x
179+
$ make -j8
180+
$ make altinstall
181+
182+
.. note::
183+
184+
Patch releases of OpenSSL have a backwards compatible ABI. You don't need
185+
to recompile Python to update OpenSSL. It's sufficient to replace the
186+
custom OpenSSL installation with a newer version.

Doc/whatsnew/3.10.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ Tracing events, with the correct line number, are generated for all lines of cod
175175
176176
The ``f_lineo`` attribute of frame objects will always contain the expected line number.
177177
178+
The ``co_lnotab`` attribute of code objects is deprecated and will be removed in 3.12.
179+
Code that needs to convert from offset to line number should use the new ``co_lines()`` method instead.
178180
179181
PEP 634: Structural Pattern Matching
180182
------------------------------------
@@ -1181,6 +1183,12 @@ Build Changes
11811183
and ``--with-tcltk-libs`` configuration options.
11821184
(Contributed by Manolis Stamatogiannakis in :issue:`42603`.)
11831185
1186+
* Add ``--with-openssl-rpath`` option to ``configure`` script. The option
1187+
simplifies building Python with a custom OpenSSL installation, e.g.
1188+
``./configure --with-openssl=/path/to/openssl --with-openssl-rpath=auto``.
1189+
(Contributed by Christian Heimes in :issue:`43466`.)
1190+
1191+
11841192
11851193
C API Changes
11861194
=============
@@ -1358,3 +1366,19 @@ Removed
13581366
AST object (``mod_ty`` type) with the public C API. The function was already
13591367
excluded from the limited C API (:pep:`384`).
13601368
(Contributed by Victor Stinner in :issue:`43244`.)
1369+
1370+
* Remove the ``symtable.h`` header file and the undocumented functions:
1371+
1372+
* ``PyST_GetScope()``
1373+
* ``PySymtable_Build()``
1374+
* ``PySymtable_BuildObject()``
1375+
* ``PySymtable_Free()``
1376+
* ``Py_SymtableString()``
1377+
* ``Py_SymtableStringObject()``
1378+
1379+
The ``Py_SymtableString()`` function was part the stable ABI by mistake but
1380+
it could not be used, because the ``symtable.h`` header file was excluded
1381+
from the limited C API.
1382+
1383+
The Python :mod:`symtable` module remains available and is unchanged.
1384+
(Contributed by Victor Stinner in :issue:`43244`.)

Include/cpython/pythonrun.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,6 @@ PyAPI_FUNC(const char *) _Py_SourceAsString(
7777
PyCompilerFlags *cf,
7878
PyObject **cmd_copy);
7979

80-
PyAPI_FUNC(struct symtable *) Py_SymtableStringObject(
81-
const char *str,
82-
PyObject *filename,
83-
int start);
84-
85-
PyAPI_FUNC(struct symtable *) _Py_SymtableStringObjectFlags(
86-
const char *str,
87-
PyObject *filename,
88-
int start,
89-
PyCompilerFlags *flags);
90-
9180

9281
/* A function flavor is also exported by libpython. It is required when
9382
libpython is accessed directly rather than using header files which defines

Include/symtable.h renamed to Include/internal/pycore_symtable.h

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
#ifndef Py_LIMITED_API
2-
#ifndef Py_SYMTABLE_H
3-
#define Py_SYMTABLE_H
1+
#ifndef Py_INTERNAL_SYMTABLE_H
2+
#define Py_INTERNAL_SYMTABLE_H
43
#ifdef __cplusplus
54
extern "C" {
65
#endif
76

8-
#include "Python-ast.h" /* mod_ty */
7+
#ifndef Py_BUILD_CORE
8+
# error "this header requires Py_BUILD_CORE define"
9+
#endif
910

10-
/* XXX(ncoghlan): This is a weird mix of public names and interpreter internal
11-
* names.
12-
*/
11+
#include "Python-ast.h" /* mod_ty */
1312

1413
typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock }
1514
_Py_block_ty;
@@ -68,23 +67,19 @@ typedef struct _symtable_entry {
6867
struct symtable *ste_table;
6968
} PySTEntryObject;
7069

71-
PyAPI_DATA(PyTypeObject) PySTEntry_Type;
70+
extern PyTypeObject PySTEntry_Type;
7271

7372
#define PySTEntry_Check(op) Py_IS_TYPE(op, &PySTEntry_Type)
7473

75-
PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *);
74+
extern int _PyST_GetScope(PySTEntryObject *, PyObject *);
7675

77-
PyAPI_FUNC(struct symtable *) PySymtable_Build(
78-
mod_ty mod,
79-
const char *filename, /* decoded from the filesystem encoding */
80-
PyFutureFeatures *future);
81-
PyAPI_FUNC(struct symtable *) PySymtable_BuildObject(
76+
extern struct symtable* _PySymtable_Build(
8277
mod_ty mod,
8378
PyObject *filename,
8479
PyFutureFeatures *future);
8580
PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *);
8681

87-
PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
82+
extern void _PySymtable_Free(struct symtable *);
8883

8984
/* Flags for def-use information */
9085

@@ -117,8 +112,14 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
117112
#define GENERATOR 1
118113
#define GENERATOR_EXPRESSION 2
119114

115+
// Used by symtablemodule.c
116+
extern struct symtable* _Py_SymtableStringObjectFlags(
117+
const char *str,
118+
PyObject *filename,
119+
int start,
120+
PyCompilerFlags *flags);
121+
120122
#ifdef __cplusplus
121123
}
122124
#endif
123-
#endif /* !Py_SYMTABLE_H */
124-
#endif /* !Py_LIMITED_API */
125+
#endif /* !Py_INTERNAL_SYMTABLE_H */

Include/pythonrun.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ extern "C" {
99

1010
PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
1111

12-
PyAPI_FUNC(struct symtable *) Py_SymtableString(
13-
const char *str,
14-
const char *filename, /* decoded from the filesystem encoding */
15-
int start);
16-
1712
PyAPI_FUNC(void) PyErr_Print(void);
1813
PyAPI_FUNC(void) PyErr_PrintEx(int);
1914
PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);

Lib/test/test_dis.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,31 @@ def f(self): return super().x
809809
0: __class__"""
810810
self.assertEqual(dedent(dis.code_info(g["C"].f)), expected_dis_info)
811811

812+
def test_super_attr_load_self_cell(self):
813+
src = """
814+
class C:
815+
def f(self):
816+
lambda: self
817+
return super().x
818+
"""
819+
expected = """\
820+
4 0 LOAD_CLOSURE 0 (self)
821+
2 BUILD_TUPLE 1
822+
4 LOAD_CONST 1 (<code object <lambda> at 0x..., file "<string>", line 4>)
823+
6 LOAD_CONST 2 ('C.f.<locals>.<lambda>')
824+
8 MAKE_FUNCTION 8 (closure)
825+
10 POP_TOP
826+
827+
5 12 LOAD_GLOBAL 0 (super)
828+
14 LOAD_DEREF 1 (__class__)
829+
16 LOAD_DEREF 0 (self)
830+
18 LOAD_ATTR_SUPER 3 ((1, True))
831+
20 RETURN_VALUE
832+
"""
833+
g = {}
834+
exec(dedent(src), g)
835+
self.do_disassembly_test(g["C"].f, expected)
836+
812837
def test_super_attr_store(self):
813838
src = """
814839
class C:

Lib/test/test_gdb.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,12 +928,12 @@ def test_wrapper_call(self):
928928
cmd = textwrap.dedent('''
929929
class MyList(list):
930930
def __init__(self):
931-
super().__init__() # wrapper_call()
931+
super().__init__() # wrapperdescr_call()
932932
933933
id("first break point")
934934
l = MyList()
935935
''')
936-
cmds_after_breakpoint = ['break wrapper_call', 'continue']
936+
cmds_after_breakpoint = ['break wrapperdescr_call', 'continue']
937937
if CET_PROTECTION:
938938
# bpo-32962: same case as in get_stack_trace():
939939
# we need an additional 'next' command in order to read
@@ -945,7 +945,7 @@ def __init__(self):
945945
gdb_output = self.get_stack_trace(cmd,
946946
cmds_after_breakpoint=cmds_after_breakpoint)
947947
self.assertRegex(gdb_output,
948-
r"<method-wrapper u?'__init__' of MyList object at ")
948+
r"methoddescr-wrapper '__init__'>, args=\(<MyList at ")
949949

950950

951951
class PyPrintTests(DebuggerTests):

Makefile.pre.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ ENSUREPIP= @ENSUREPIP@
202202
OPENSSL_INCLUDES=@OPENSSL_INCLUDES@
203203
OPENSSL_LIBS=@OPENSSL_LIBS@
204204
OPENSSL_LDFLAGS=@OPENSSL_LDFLAGS@
205+
OPENSSL_RPATH=@OPENSSL_RPATH@
205206

206207
# Default zoneinfo.TZPATH. Added here to expose it in sysconfig.get_config_var
207208
TZPATH=@TZPATH@
@@ -1086,7 +1087,6 @@ PYTHON_HEADERS= \
10861087
$(srcdir)/Include/sliceobject.h \
10871088
$(srcdir)/Include/structmember.h \
10881089
$(srcdir)/Include/structseq.h \
1089-
$(srcdir)/Include/symtable.h \
10901090
$(srcdir)/Include/sysmodule.h \
10911091
$(srcdir)/Include/token.h \
10921092
$(srcdir)/Include/traceback.h \
@@ -1166,6 +1166,7 @@ PYTHON_HEADERS= \
11661166
$(srcdir)/Include/internal/pycore_pymem.h \
11671167
$(srcdir)/Include/internal/pycore_pystate.h \
11681168
$(srcdir)/Include/internal/pycore_runtime.h \
1169+
$(srcdir)/Include/internal/pycore_symtable.h \
11691170
$(srcdir)/Include/internal/pycore_sysmodule.h \
11701171
$(srcdir)/Include/internal/pycore_traceback.h \
11711172
$(srcdir)/Include/internal/pycore_tuple.h \
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The ``configure`` script now supports ``--with-openssl-rpath`` option.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy