Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8ab90f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into super_call
2 parentsccbb515 +148bc05 commitb8ab90f

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 objectsis deprecatedand will be removedin3.12.
179+
Code that needs to convertfrom offset to line number should use the new``co_lines()`` method instead.
178180
179181
PEP634: Structural Pattern Matching
180182
------------------------------------
@@ -1181,6 +1183,12 @@ Build Changes
11811183
and``--with-tcltk-libs`` configuration options.
11821184
(Contributed by Manolis Stamatogiannakisin :issue:`42603`.)
11831185
1186+
* Add``--with-openssl-rpath`` option to``configure`` script. The option
1187+
simplifies building Pythonwith a custom OpenSSL installation, e.g.
1188+
``./configure--with-openssl=/path/to/openssl--with-openssl-rpath=auto``.
1189+
(Contributed by Christian Heimesin :issue:`43466`.)
1190+
1191+
11841192
11851193
CAPI Changes
11861194
=============
@@ -1358,3 +1366,19 @@ Removed
13581366
ASTobject (``mod_ty``type)with the public CAPI. The function was already
13591367
excludedfrom the limited C API (:pep:`384`).
13601368
(Contributed by Victor Stinnerin :issue:`43244`.)
1369+
1370+
* Remove the``symtable.h`` headerfileand 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 stableABI by mistake but
1380+
it couldnot be used, because the``symtable.h`` headerfile was excluded
1381+
from the limited CAPI.
1382+
1383+
The Python :mod:`symtable` module remains availableandis unchanged.
1384+
(Contributed by Victor Stinnerin :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(structsymtable*)Py_SymtableStringObject(
81-
constchar*str,
82-
PyObject*filename,
83-
intstart);
84-
85-
PyAPI_FUNC(structsymtable*)_Py_SymtableStringObjectFlags(
86-
constchar*str,
87-
PyObject*filename,
88-
intstart,
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.hrenamed 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-
#ifndefPy_LIMITED_API
2-
#ifndefPy_SYMTABLE_H
3-
#definePy_SYMTABLE_H
1+
#ifndefPy_INTERNAL_SYMTABLE_H
2+
#definePy_INTERNAL_SYMTABLE_H
43
#ifdef__cplusplus
54
extern"C" {
65
#endif
76

8-
#include"Python-ast.h"/* mod_ty */
7+
#ifndefPy_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
typedefenum_block_type {FunctionBlock,ClassBlock,ModuleBlock }
1514
_Py_block_ty;
@@ -68,23 +67,19 @@ typedef struct _symtable_entry {
6867
structsymtable*ste_table;
6968
}PySTEntryObject;
7069

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

7372
#definePySTEntry_Check(op) Py_IS_TYPE(op, &PySTEntry_Type)
7473

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

77-
PyAPI_FUNC(structsymtable*)PySymtable_Build(
78-
mod_tymod,
79-
constchar*filename,/* decoded from the filesystem encoding */
80-
PyFutureFeatures*future);
81-
PyAPI_FUNC(structsymtable*)PySymtable_BuildObject(
76+
externstructsymtable*_PySymtable_Build(
8277
mod_tymod,
8378
PyObject*filename,
8479
PyFutureFeatures*future);
8580
PyAPI_FUNC(PySTEntryObject*)PySymtable_Lookup(structsymtable*,void*);
8681

87-
PyAPI_FUNC(void)PySymtable_Free(structsymtable*);
82+
externvoid_PySymtable_Free(structsymtable*);
8883

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

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

115+
// Used by symtablemodule.c
116+
externstructsymtable*_Py_SymtableStringObjectFlags(
117+
constchar*str,
118+
PyObject*filename,
119+
intstart,
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(constchar*,constchar*,int);
1111

12-
PyAPI_FUNC(structsymtable*)Py_SymtableString(
13-
constchar*str,
14-
constchar*filename,/* decoded from the filesystem encoding */
15-
intstart);
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+
deftest_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
deftest_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= ['breakwrapper_call','continue']
936+
cmds_after_breakpoint= ['breakwrapperdescr_call','continue']
937937
ifCET_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-wrapperu?'__init__' ofMyList object at ")
948+
r"methoddescr-wrapper '__init__'>, args=\(<MyList at ")
949949

950950

951951
classPyPrintTests(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.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Remove the ``symtable.h`` header file and the undocumented functions:
2+
3+
* ``PyST_GetScope()``
4+
* ``PySymtable_Build()``
5+
* ``PySymtable_BuildObject()``
6+
* ``PySymtable_Free()``
7+
* ``Py_SymtableString()``
8+
* ``Py_SymtableStringObject()``
9+
10+
The ``Py_SymtableString()`` function was part the stable ABI by mistake but it
11+
could not be used, because the ``symtable.h`` header file was excluded from the
12+
limited C API.
13+
14+
The Python:mod:`symtable` module remains available and is unchanged.
15+
16+
Patch by Victor Stinner.

‎Modules/symtablemodule.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#include"Python.h"
22

3-
#include"code.h"
43
#include"Python-ast.h"
5-
#include"symtable.h"
4+
#include"pycore_symtable.h"// struct symtable
65

76
#include"clinic/symtablemodule.c.h"
87
/*[clinic input]
@@ -62,7 +61,7 @@ _symtable_symtable_impl(PyObject *module, PyObject *source,
6261
t= (PyObject*)st->st_top;
6362
Py_INCREF(t);
6463
PyMem_Free((void*)st->st_future);
65-
PySymtable_Free(st);
64+
_PySymtable_Free(st);
6665
returnt;
6766
}
6867

‎PC/python3dll.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ EXPORT_FUNC(Py_SetPath)
8080
EXPORT_FUNC(Py_SetProgramName)
8181
EXPORT_FUNC(Py_SetPythonHome)
8282
EXPORT_FUNC(Py_SetRecursionLimit)
83-
EXPORT_FUNC(Py_SymtableString)
8483
EXPORT_FUNC(Py_VaBuildValue)
8584
EXPORT_FUNC(Py_XNewRef)
8685
EXPORT_FUNC(PyArg_Parse)

‎PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
<ClIncludeInclude="..\Include\internal\pycore_pystate.h" />
209209
<ClIncludeInclude="..\Include\internal\pycore_runtime.h" />
210210
<ClIncludeInclude="..\Include\internal\pycore_sysmodule.h" />
211+
<ClIncludeInclude="..\Include\internal\pycore_symtable.h" />
211212
<ClIncludeInclude="..\Include\internal\pycore_traceback.h" />
212213
<ClIncludeInclude="..\Include\internal\pycore_tuple.h" />
213214
<ClIncludeInclude="..\Include\internal\pycore_ucnhash.h" />

‎PCbuild/pythoncore.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@
585585
<ClIncludeInclude="..\Include\internal\pycore_sysmodule.h">
586586
<Filter>Include\internal</Filter>
587587
</ClInclude>
588+
<ClIncludeInclude="..\Include\internal\pycore_symtable.h">
589+
<Filter>Include\internal</Filter>
590+
</ClInclude>
588591
<ClIncludeInclude="..\Include\internal\pycore_traceback.h">
589592
<Filter>Include\internal</Filter>
590593
</ClInclude>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp