Commit 960aa31f authored by Matti Picus's avatar Matti Picus
Browse files

merge py3.8 into release

--HG--
branch : release-pypy3.8-v7.x
Pipeline #60180 passed with stage
in 8 minutes and 45 seconds
......@@ -19,6 +19,18 @@ from site import USER_BASE
from site import USER_SITE
HAS_USER_SITE = True
# See also: site.py/sysconfig.py
def _get_implementation():
if '__pypy__' in sys.builtin_module_names:
return 'PyPy'
return 'Python'
IMPLEMENTATION = _get_implementation()
IMPLEMENTATION_LOWER = IMPLEMENTATION.lower()
WINDOWS_SCHEME = {
'purelib': '$base/Lib/site-packages',
'platlib': '$base/Lib/site-packages',
......@@ -29,16 +41,16 @@ WINDOWS_SCHEME = {
INSTALL_SCHEMES = {
'unix_prefix': {
'purelib': '$base/lib/$implementation_lower$py_version_short/site-packages',
'platlib': '$platbase/lib/$implementation_lower$py_version_short/site-packages',
'headers': '$base/include/$implementation_lower$py_version_short$abiflags/$dist_name',
'purelib': '$base/lib/' + IMPLEMENTATION_LOWER + '$py_version_short/site-packages',
'platlib': '$platbase/lib/' + IMPLEMENTATION_LOWER + '$py_version_short/site-packages',
'headers': '$base/include/' + IMPLEMENTATION_LOWER + '$py_version_short$abiflags/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
},
'unix_home': {
'purelib': '$base/lib/$implementation_lower',
'platlib': '$base/lib/$implementation_lower',
'headers': '$base/include/$implementation_lower/$dist_name',
'purelib': '$base/lib/' + IMPLEMENTATION_LOWER,
'platlib': '$base/lib/' + IMPLEMENTATION_LOWER,
'headers': '$base/include/' + IMPLEMENTATION_LOWER + '/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
},
......@@ -50,8 +62,8 @@ if HAS_USER_SITE:
INSTALL_SCHEMES['nt_user'] = {
'purelib': '$usersite',
'platlib': '$usersite',
'headers': '$userbase/$implementation$py_version_nodot/Include/$dist_name',
'scripts': '$userbase/$implementation$py_version_nodot/Scripts',
'headers': '$userbase/' + IMPLEMENTATION + '$py_version_nodot/Include/$dist_name',
'scripts': '$userbase/' + IMPLEMENTATION + '$py_version_nodot/Scripts',
'data' : '$userbase',
}
......@@ -59,7 +71,7 @@ if HAS_USER_SITE:
'purelib': '$usersite',
'platlib': '$usersite',
'headers':
'$userbase/include/$implementation_lower$py_version_short$abiflags/$dist_name',
'$userbase/include/' + IMPLEMENTATION_LOWER + '$py_version_short$abiflags/$dist_name',
'scripts': '$userbase/bin',
'data' : '$userbase',
}
......@@ -303,8 +315,6 @@ class install(Command):
'sys_exec_prefix': exec_prefix,
'exec_prefix': exec_prefix,
'abiflags': abiflags,
'implementation_lower': _get_implementation().lower(),
'implementation': _get_implementation(),
}
if HAS_USER_SITE:
......
......@@ -66,16 +66,16 @@ class Get_argspecTest(unittest.TestCase):
f'(iterable=(), /)'
f'\n{List.__doc__}')
tiptest(list.__new__,
'(*args, **kwargs)\n'
'(listtype, *args, **keywords)\n'
'Create and return a new object. '
'See help(type) for accurate signature.')
tiptest(list.__init__,
'(self, /, *args, **kwargs)\n'
'(self, *args, **keywords)\n'
'Initialize self. See help(type(self)) for accurate signature.')
append_doc = "\nAppend object to the end of the list."
tiptest(list.append, '(self, object, /)' + append_doc)
tiptest(List.append, '(self, object, /)' + append_doc)
tiptest([].append, '(object, /)' + append_doc)
tiptest(list.append, '(self, item)' + append_doc)
tiptest(List.append, '(self, item)' + append_doc)
tiptest([].append, '(item)' + append_doc)
tiptest(types.MethodType, "instancemethod(function, instance, class)")
tiptest(SB(), default_tip)
......
......@@ -385,9 +385,8 @@ def setcopyright():
builtins.copyright = _sitebuiltins._Printer("copyright", sys.copyright)
licenseargs = None
if is_pypy:
credits = "PyPy is maintained by the PyPy developers: http://pypy.org/"
credits = "PyPy is maintained by the PyPy developers\nhttp://pypy.org/"
license = "See https://foss.heptapod.net/pypy/pypy/src/default/LICENSE"
licenseargs = (license,)
elif sys.platform[:4] == 'java':
credits = ("Jython is maintained by the Jython developers "
"(www.jython.org).")
......
......@@ -523,6 +523,8 @@ class BaseTestCase(unittest.TestCase):
input = ''
if 'stderr' not in kw:
kw['stderr'] = subprocess.PIPE
# PyPy - without the flush tests hang
sys.stderr.flush()
proc = subprocess.run(args,
universal_newlines=True,
input=input,
......
......@@ -66,7 +66,6 @@ ffi = build_ffi_for_binding(
"bignum",
"bio",
"cmac",
"conf",
"crypto",
"ct",
"dh",
......
......@@ -45,7 +45,7 @@ FUNCTIONS = """
void ASN1_OBJECT_free(ASN1_OBJECT *);
/* ASN1 STRING */
unsigned char *ASN1_STRING_data(ASN1_STRING *);
const unsigned char *ASN1_STRING_get0_data(ASN1_STRING *);
int ASN1_STRING_set(ASN1_STRING *, const void *, int);
/* ASN1 OCTET STRING */
......
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
INCLUDES = """
#include <openssl/conf.h>
"""
TYPES = """
"""
FUNCTIONS = """
void OPENSSL_config(const char *);
/* This is a macro in 1.1.0 */
void OPENSSL_no_config(void);
"""
CUSTOMIZATIONS = """
"""
......@@ -225,8 +225,6 @@ int sk_X509_CRL_push(Cryptography_STACK_OF_X509_CRL *, X509_CRL *);
X509_CRL *sk_X509_CRL_value(Cryptography_STACK_OF_X509_CRL *, int);
long X509_CRL_get_version(X509_CRL *);
ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *);
ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *);
X509_NAME *X509_CRL_get_issuer(X509_CRL *);
Cryptography_STACK_OF_X509_REVOKED *X509_CRL_get_REVOKED(X509_CRL *);
......
......@@ -88,6 +88,9 @@ def extra_link_args(compiler_type):
# default on Python 3.3+ but not on 2.x.
return ['/NXCOMPAT', '/DYNAMICBASE']
else:
# The PyPy buildbots install OpenSSL to /usr/local/lib
if os.path.exists("/usr/local/lib"):
return["-L/usr/local/lib"]
return []
......
......@@ -432,7 +432,7 @@ class _SSLSocket(object):
raise ssl_error(None)
else:
if not lib.X509_VERIFY_PARAM_set1_ip(
param, lib.ASN1_STRING_data(ip), lib.ASN1_STRING_length(ip)):
param, lib.ASN1_STRING_get0_data(ip), lib.ASN1_STRING_length(ip)):
raise ssl_error(None)
@property
......
......@@ -3,9 +3,9 @@ from _pypy_openssl import ffi
from _pypy_openssl import lib
def _string_from_asn1(asn1):
data = lib.ASN1_STRING_data(asn1)
data = lib.ASN1_STRING_get0_data(asn1)
length = lib.ASN1_STRING_length(asn1)
return _str_with_len(ffi.cast("char*",data), length)
return _str_with_len(ffi.cast("const char*",data), length)
def _str_with_len(char_ptr, length):
return ffi.buffer(char_ptr, length)[:].decode('utf-8').strip('\n')
......
......@@ -25,7 +25,6 @@ ffi = build_ffi_for_binding(
"bignum",
"bio",
"cmac",
"conf",
"crypto",
"ct",
"dh",
......
......@@ -508,12 +508,11 @@ class TkApp(object):
def getboolean(self, s):
if isinstance(s, int):
return bool(s)
try:
s = s.encode('utf-8')
except AttributeError:
raise TypeError
if b'\x00' in s:
if isinstance(s, Tcl_Obj):
s = s.string
if '\x00' in s:
raise TypeError
s = s.encode('utf-8')
v = tkffi.new("int*")
res = tklib.Tcl_GetBoolean(self.interp, s, v)
if res == tklib.TCL_ERROR:
......@@ -523,12 +522,11 @@ class TkApp(object):
def getint(self, s):
if isinstance(s, int):
return s
try:
s = s.encode('utf-8')
except AttributeError:
raise TypeError
if b'\x00' in s:
if isinstance(s, Tcl_Obj):
s = s.string
if '\x00' in s:
raise TypeError
s = s.encode('utf-8')
if tklib.HAVE_LIBTOMMATH or tklib.HAVE_WIDE_INT_TYPE:
value = tklib.Tcl_NewStringObj(s, -1)
if not value:
......@@ -550,12 +548,11 @@ class TkApp(object):
def getdouble(self, s):
if isinstance(s, (float, int)):
return float(s)
try:
s = s.encode('utf-8')
except AttributeError:
raise TypeError
if b'\x00' in s:
if isinstance(s, Tcl_Obj):
s = s.string
if '\x00' in s:
raise TypeError
s = s.encode('utf-8')
v = tkffi.new("double*")
res = tklib.Tcl_GetDouble(self.interp, s, v)
if res == tklib.TCL_ERROR:
......
......@@ -19,9 +19,13 @@ elif sys.platform == 'win32':
libdirs = []
elif sys.platform == 'darwin':
# homebrew
homebrew = os.environ.get('HOMEBREW_PREFIX', '')
incdirs = ['/usr/local/opt/tcl-tk/include']
linklibs = ['tcl8.6', 'tk8.6']
libdirs = ['/usr/local/opt/tcl-tk/lib']
libdirs = []
if homebrew:
incdirs.append(homebrew + '/include')
libdirs.append(homebrew + '/opt/tcl-tk/lib')
else:
# On some Linux distributions, the tcl and tk libraries are
# stored in /usr/include, so we must check this case also
......
......@@ -3,7 +3,7 @@ PyPy v7.3.11: release of python 2.7, 3.8, and 3.9
=================================================
..
Changelog up to commit 46a7476ee4c3
Changelog up to commit 207858e40e63
.. note::
This is a pre-release announcement. When the release actually happens, it
......@@ -114,6 +114,9 @@ Bugfixes
- Package tkinter for macOS. Previously the portable builds did not include it
(issues 3760_, 3868_).
- Fix memory leak in certificate validation in ``_ssl`` (issue 3871_)
- Add ``__qualname__`` to some cpyext types (issue 3878_)
- Clean up some deprecated functions in OpenSSL wrapper ``_ssl``
Speedups and enhancements
~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -127,14 +130,24 @@ Python 3.8+
some security fixes, as documented in the `CPython release note`_
- Ensure that only valid values are passed from ``Py_UNICODE_*`` calls to
unicodedb lookups (issue 3870_)
- Fix ast ``lineno``, ``end_lineno``, ``end_col_number`` around decorators (issue 3876_)
- Re-apply fix for issue 3436_ since our ensurepip setuptools version is ``< 59.0``
- In ``_tkinter``, ``getboolean``, ``getint``, ``getdouble`` accepts a ``Tcl_Obj`` (bpo-23880_)
- Make builtin ``credits``, ``license()`` more like CPython
- Add docstrings to some builtin classes and methods
Python 3.9
----------
- Fix pure-python implmentation of ``functools`` (issue 3869_). see also cpython GH-100242_
- Remove ``type.__ne__``, the inherited behaviour from ``object.__ne__`` is the
correct one (issue 3879_)
- Fix invalid parsing rule for ``genexps`` as the non-singular argument in a call (issue 3873_)
.. _`using SMT solvers and fuzzing`: https://www.pypy.org/posts/2022/12/jit-bug-finding-smt-fuzzing.html
.. _`CPython release note`: https://www.python.org/downloads/release/python-3816
.. _bpo-23880: https://bugs.python.org/issue23880
.. _GH-100242: https://github.com/python/cpython/issues/100242
.. _3436: https://foss.heptapod.net/pypy/pypy/-/issues/3436
.. _3760: https://foss.heptapod.net/pypy/pypy/-/issues/3760
.. _3832: https://foss.heptapod.net/pypy/pypy/-/issues/3832
.. _3865: https://foss.heptapod.net/pypy/pypy/-/issues/3865
......@@ -142,3 +155,6 @@ Python 3.9
.. _3869: https://foss.heptapod.net/pypy/pypy/-/issues/3869
.. _3870: https://foss.heptapod.net/pypy/pypy/-/issues/3870
.. _3871: https://foss.heptapod.net/pypy/pypy/-/issues/3871
.. _3873: https://foss.heptapod.net/pypy/pypy/-/issues/3873
.. _3876: https://foss.heptapod.net/pypy/pypy/-/issues/3876
.. _3879: https://foss.heptapod.net/pypy/pypy/-/issues/3879
......@@ -201,7 +201,6 @@ class PythonCodeMaker(ast.ASTVisitor):
self.argcount = 0
self.posonlyargcount = 0
self.kwonlyargcount = 0
self.lineno_set = False
self.lineno = 0
self.add_none_to_final_return = True
......@@ -238,9 +237,7 @@ class PythonCodeMaker(ast.ASTVisitor):
def emit_op(self, op):
"""Emit an opcode without an argument."""
instr = Instruction(op)
if not self.lineno_set:
instr.lineno = self.lineno
self.lineno_set = True
instr.lineno = self.lineno
if not self.is_dead_code():
self.current_block.instructions.append(instr)
if op == ops.RETURN_VALUE:
......@@ -250,9 +247,7 @@ class PythonCodeMaker(ast.ASTVisitor):
def emit_op_arg(self, op, arg):
"""Emit an opcode with an integer argument."""
instr = Instruction(op, arg)
if not self.lineno_set:
instr.lineno = self.lineno
self.lineno_set = True
instr.lineno = self.lineno
if not self.is_dead_code():
self.current_block.instructions.append(instr)
......@@ -302,11 +297,9 @@ class PythonCodeMaker(ast.ASTVisitor):
index = self.add_const(obj)
self.emit_op_arg(ops.LOAD_CONST, index)
def update_position(self, lineno, force=False):
"""Possibly change the lineno for the next instructions."""
if force or lineno > self.lineno:
self.lineno = lineno
self.lineno_set = False
def update_position(self, lineno):
"""Change the lineno for the next instructions."""
self.lineno = lineno
def _resolve_block_targets(self, blocks):
"""Compute the arguments of jump instructions."""
......@@ -473,21 +466,8 @@ class PythonCodeMaker(ast.ASTVisitor):
if instr.lineno:
# compute deltas
line = instr.lineno - current_line
if line < 0:
continue
addr = offset - current_off
# Python assumes that lineno always increases with
# increasing bytecode address (lnotab is unsigned
# char). Depending on when SET_LINENO instructions
# are emitted this is not always true. Consider the
# code:
# a = (1,
# b)
# In the bytecode stream, the assignment to "a"
# occurs after the loading of "b". This works with
# the C Python compiler because it only generates a
# SET_LINENO instruction for the assignment.
if line or addr:
if line:
_encode_lnotab_pair(addr, line, table)
current_line = instr.lineno
current_off = offset
......
......@@ -1363,9 +1363,14 @@ class ASTBuilder(object):
args = None
if not keywords:
keywords = None
if not rpar_node:
# if there is an rpar_node, it holds the end lineno, column info
# see https://foss.heptapod.net/pypy/pypy/-/issues/3876#note_276975
# and the test_astbuilder.test_decorator_end test
rpar_node = args_node
return ast.Call(callable_expr, args, keywords, callable_expr.lineno,
callable_expr.col_offset, args_node.get_end_lineno(),
args_node.get_end_column())
callable_expr.col_offset, rpar_node.get_end_lineno(),
rpar_node.get_end_column())
def parse_number(self, raw, n):
base = 10
......
This diff is collapsed.
......@@ -2024,4 +2024,20 @@ class TestAstBuilder:
tree = self.get_ast("f'{((}')")
assert excinfo.value.msg == "unmatched ')'"
def test_decorator_end(self):
tree = self.get_ast("""
@deco([
1,
2,
3,
4,
5,
6,
]
)
def f(arg):
return arg
""")
attr_b = tree.body[0].decorator_list[0]
assert attr_b.end_lineno == 10
assert attr_b.end_col_offset == 1
......@@ -2009,8 +2009,16 @@ x = [c for c in buggy_lnotab.__code__.co_lnotab]
pass
x = [c for c in f.__code__.co_lnotab]
'''
# XXX: 3.7 value, CPython 3.8 has [0, 1, 2, 2, 2, 255]
self.st(func, 'x', [0, 1, 2, 2])
self.st(func, 'x', [0, 1, 2, 2, 2, 255])
def test_lineno_expr(self):
func = '''def f():
g(
a
)
x = list(f.__code__.co_lnotab)
'''
self.st(func, 'x', [0, 1, 2, 1, 2, 255])
def test_while_false_break(self):
self.st("x=1\nwhile False: break", "x", 1)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment