[issue39154] "utf8" not always a synonym for "utf-8" in lib2to3

2019-12-29 Thread Peter Ludemann


Peter Ludemann  added the comment:

To clarify and fix a typo ... lib2to3.pgen2.tokenize.detect_encoding checks for 
'utf-8'(and 'utf_8') but not 'utf8' in various places. Similarly for 'latin-1' 
and 'latin1'. (The codecs documentation page allows 'utf8' and 'latin1' as 
codecs.)

['UTF-8' is taken care of in _get_normal_name] 

See also https://bugs.python.org/issue39155

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread Ned Deily


Change by Ned Deily :


--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22593] Automate update of doc references to UCD version when it changes.

2019-12-29 Thread Ned Deily


Change by Ned Deily :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, mdk
versions: +Python 3.9 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39154] "utf8" not always a synonym for "utf-8" in lib2to3

2019-12-29 Thread Ned Deily


Change by Ned Deily :


--
Removed message: https://bugs.python.org/msg358997

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39154] "utf8" not always a synonym for "utf-8" in lib2to3

2019-12-29 Thread Ned Deily


Change by Ned Deily :


--
Removed message: https://bugs.python.org/msg358994

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38588] Use-after-free in dict/list

2019-12-29 Thread Inada Naoki


Inada Naoki  added the comment:

Would you benchmark the performance?

How about calling Py_INCREF and Py_DECREF in PyObject_RichCompare or 
do_richcompare?

It is safer than checking all caller of the PyObject_RichCompare and 
PyObject_RichCompareBool.
And it would be faster when PyObject_RichCompareBool is called with v == w and 
op == Py_EQ.

/* Quick result when objects are the same.
   Guarantees that identity implies equality. */
if (v == w) {
if (op == Py_EQ)
return 1;
else if (op == Py_NE)
return 0;
}

--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39141] IDLE Clear function returns 256 on Mac OS Catalina

2019-12-29 Thread Ned Deily


Change by Ned Deily :


--
assignee:  -> terry.reedy
components: +IDLE

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39141] IDLE Clear function returns 256 on Mac OS Catalina

2019-12-29 Thread Ned Deily


Ned Deily  added the comment:

Unfortunately, this is not going to work as you expect because you are mixing 
commands for different windowing systems.  The OS-level 'clear' command is used 
to clear a normal terminal window by issuing special character sequences to 
standard output that are recognized by the terminal emulator, like for instance 
Terminal.app on macOS.  When you run commands using os.system() under IDLE on 
macOS, the standard output descriptor for the subprocess created by os.system 
is not handled by IDLE.  Currently open Issue11820 describes this problem.  You 
are apparently running IDLE.app (by launching the app from the Finder) and the 
command fails because standard output of the subprocess is not associated with 
a terminal window.  If, instead, you launched IDLE from a terminal window (in 
Terminal.app):

/usr/local/bin/idle3.8

and ran your test, you would see that the 'clear' clears the Terminal.app 
window, not the IDLE shell window (and now returns a status of 0), still not 
what you are looking for.

Even if Issue11820 is implemented such that the standard output from 
subprocesses are associated with the IDLE shell window, there would still be a 
problem in that the special character sequences sent by the 'clear' command 
would most likely not be recognized by the IDLE shell window or its underlying 
Tk widget, so using the OS 'clear' command still would not work.  A better 
solution is for IDLE to provide its own 'clear' command and that is the subject 
of open Issue6143, which this issue should probably be closed as a duplicate of.

--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39037] Fix the trial order of the __exit__ and __enter__ methods in the with statement documentation

2019-12-29 Thread miss-islington


miss-islington  added the comment:


New changeset cbfafa3e3625dae96ce392c88c793f8af55167bf by Miss Islington (bot) 
in branch '3.8':
bpo-39037: Fix lookup order of magic methods in with statement documentation 
(GH-17608)
https://github.com/python/cpython/commit/cbfafa3e3625dae96ce392c88c793f8af55167bf


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39037] Fix the trial order of the __exit__ and __enter__ methods in the with statement documentation

2019-12-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17187
pull_request: https://github.com/python/cpython/pull/17749

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39037] Fix the trial order of the __exit__ and __enter__ methods in the with statement documentation

2019-12-29 Thread Nick Coghlan

Nick Coghlan  added the comment:


New changeset 226e6e7d4326cf91ef37e13528eb1f62de1bb832 by Nick Coghlan (Géry 
Ogam) in branch 'master':
bpo-39037: Fix lookup order of magic methods in with statement documentation 
(GH-17608)
https://github.com/python/cpython/commit/226e6e7d4326cf91ef37e13528eb1f62de1bb832


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39161] Py_NewInterpreter docs need updating for multi-phase initialization

2019-12-29 Thread Nick Coghlan


New submission from Nick Coghlan :

The Py_NewInterpreter docs only cover the behaviour of extension modules that 
use single-phase initialization: 
https://docs.python.org/3/c-api/init.html#c.Py_NewInterpreter

Multi-phase initialization allows each subinterpreter to get its own copy of 
extension modules as well, with only C/C++ level static and global variables 
being shared.

--
assignee: docs@python
components: Documentation
messages: 359019
nosy: docs@python, ncoghlan, petr.viktorin
priority: normal
severity: normal
stage: needs patch
status: open
title: Py_NewInterpreter docs need updating for multi-phase initialization
type: enhancement
versions: Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39153] Clarify refcounting semantics of PyDict_SetItem[String]

2019-12-29 Thread Nick Coghlan


Nick Coghlan  added the comment:

Right, that's why I don't think the other "*SetItem*" operations should get a 
Sphinx note - just a sentence, as was already done for PySequence_SetItem.

If it weren't for PyList_SetItem being different, none of the others would need 
the clarification at all.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw


Change by anthony shaw :


--
nosy: +twouters

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw


Change by anthony shaw :


--
nosy: +anthonypjshaw

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22593] Automate update of doc references to UCD version when it changes.

2019-12-29 Thread Noah Massman-Hall


Noah Massman-Hall  added the comment:

I ended up doing exactly what I said would probably be needed, and wrote a 
small sphinx extension that handles this. I kept the same reST substitution 
syntax, but I'm parsing for '|ucd_version|' as the source files are read in and 
just replacing it with the version number.

Feedback is much appreciated. This is my first really involved PR. :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22593] Automate update of doc references to UCD version when it changes.

2019-12-29 Thread Noah Massman-Hall


Change by Noah Massman-Hall :


--
pull_requests: +17186
pull_request: https://github.com/python/cpython/pull/17748

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw


Change by anthony shaw :


--
keywords: +patch
pull_requests: +17185
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17747

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw


anthony shaw  added the comment:

Updated version based on principles:

- Should not specify --with(out) in help string
- Sentences should start with lowercase (as autoconf generates the builtin 
string with lower case)
- --with-xyx=VALUE will be described as "overriding"
- --with-xyz will be described as "enabling" said feature
- Mac flags should have the same descriptions as what is in Mac/README.rst
- default value should be in brackets (if known)
- Enumerated options should be shown as =VAL1|VAL2 or [=VAL1|VAL2] if optional

 Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE   do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-universalsdk[=SDKDIR]
  create a universal binary build. SDKDIR specifies
  which macOS SDK should be used to perform the build,
  see Mac/README.rst. (default is no)
  --enable-framework[=INSTALLDIR]
  create a Python.framework rather than a traditional
  Unix install. optional INSTALLDIR specifies the
  installation path. see Mac/README.rst (default is
  no)
  --enable-shared enable building a shared Python library (default is
  no)
  --enable-profiling  enable C-level code profiling with gprof (default is
  no)
  --enable-optimizations  enable expensive, stable optimizations (PGO, etc.)
  (default is no)
  --enable-loadable-sqlite-extensions
  support loadable extensions in _sqlite module, see
  Doc/library/sqlite3.rst (default is no)
  --enable-ipv6   enable ipv6 (with ipv4) support, see
  Doc/library/socket.rst (default is yes if supported)
  --enable-big-digits[=15|30]
  use big digits (30 or 15 bits) for Python longs
  (default is no)]

 Optional Packages:
  --with-PACKAGE[=ARG]use PACKAGE [ARG=yes]
  --without-PACKAGE   do not use PACKAGE (same as --with-PACKAGE=no)
  --with-universal-archs=ARCH
  specify the kind of universal binary that should be
  created. this option is only valid when
  --enable-universalsdk is set; options are:
  ("32-bit", "64-bit", "3-way", "intel", "intel-32",
  "intel-64", or "all") see Mac/README.rst
  --with-framework-name=FRAMEWORK
  specify the name for the python framework on macOS
  only valid when --enable-framework is set. see
  Mac/README.rst (default is 'Python')
  --with-cxx-main[=COMPILER]
  compile main() and link Python executable with C++
  compiler specified in COMPILER (default is $CXX)
  --with-suffix=SUFFIXset executable suffix to SUFFIX (default is '.exe')
  --with-pydebug  build with Py_DEBUG defined (default is no)
  --with-trace-refs   enable tracing references for debugging purpose
  (default is no)
  --with-assertions   build with C assertions enabled (default is no)
  --with-lto  enable Link-Time-Optimization in any build (default
  is no)
  --with-hash-algorithm=[fnv|siphash24]
  select hash algorithm for use in Python/pyhash.c
  (default is SipHash24)
  --with-address-sanitizer
  enable AddressSanitizer memory allocation
  controller, 'asan' (default is no)
  --with-memory-sanitizer enable MemorySanitizer memory allocation controller,
  'msan' (default is no)
  --with-undefined-behavior-sanitizer
  enable UndefinedBehaviorSanitizer memory allocation
  controller, 'ubsan' (default is no)
  --with-libs='lib1 ...'  link against additional libs (default is no)
  --with-system-expat build pyexpat module using an installed system expat
  library, see Doc/library/pyexpat.rst (default is no)
  --with-system-ffi   build _ctypes module using an installed ffi library,
  see Doc/library/ctypes.rst (default is system
  dependant)
  --with-system-libmpdec  build _decimal module using an installed libmpdec
  library, see Doc/library/decimal.rst (default is no)
  --with-tcltk-includes='-I...'
  override search for Tcl and Tk include files
  --with-tcltk-libs='-L...'
  override search for Tcl and Tk libs
  --with-dbmliborder=db1:db2:...
  override order to check db 

[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw


anthony shaw  added the comment:

Current 

 Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE   do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-universalsdk[=SDKDIR]
  Build fat binary against Mac OS X SDK
  --enable-framework[=INSTALLDIR]
  Build (MacOSX|Darwin) framework
  --enable-shared disable/enable building shared python library
  --enable-profiling  enable C-level code profiling
  --enable-optimizations  Enable expensive, stable optimizations (PGO, etc).
  Disabled by default.
  --enable-loadable-sqlite-extensions
  support loadable extensions in _sqlite module
  --enable-ipv6   Enable ipv6 (with ipv4) support
  --disable-ipv6  Disable ipv6 support
  --enable-big-digits[=BITS]
  use big digits for Python longs [[BITS=30]]

 Optional Packages:
  --with-PACKAGE[=ARG]use PACKAGE [ARG=yes]
  --without-PACKAGE   do not use PACKAGE (same as --with-PACKAGE=no)
  --with-universal-archs=ARCH
  select architectures for universal build ("32-bit",
  "64-bit", "3-way", "intel", "intel-32", "intel-64",
  or "all")
  --with-framework-name=FRAMEWORK
  specify an alternate name of the framework built
  with --enable-framework
  --with-cxx-main=
  compile main() and link python executable with C++
  compiler
  --with-suffix=.exe  set executable suffix
  --with-pydebug  build with Py_DEBUG defined
  --with-trace-refs   enable tracing references for debugging purpose
  --with-assertions   build with C assertions enabled
  --with-lto  Enable Link Time Optimization in any build. Disabled
  by default.
  --with-hash-algorithm=[fnv|siphash24]
  select hash algorithm
  --with-address-sanitizer
  enable AddressSanitizer (asan)
  --with-memory-sanitizer enable MemorySanitizer (msan)
  --with-undefined-behavior-sanitizer
  enable UndefinedBehaviorSanitizer (ubsan)
  --with-libs='lib1 ...'  link against additional libs
  --with-system-expat build pyexpat module using an installed expat
  library
  --with-system-ffi   build _ctypes module using an installed ffi library
  --with-system-libmpdec  build _decimal module using an installed libmpdec
  library
  --with-tcltk-includes='-I...'
  override search for Tcl and Tk include files
  --with-tcltk-libs='-L...'
  override search for Tcl and Tk libs
  --with-dbmliborder=db1:db2:...
  order to check db backends for dbm. Valid value is a
  colon separated string with the backend names
  `ndbm', `gdbm' and `bdb'.
  --with(out)-doc-strings disable/enable documentation strings
  --with(out)-pymallocdisable/enable specialized mallocs
  --with(out)-c-locale-coercion
  disable/enable C locale coercion to a UTF-8 based
  locale
  --with-valgrind Enable Valgrind support
  --with(out)-dtrace  disable/enable DTrace support
  --with-libm=STRING  math library
  --with-libc=STRING  C library
  --with(out)-computed-gotos
  Use computed gotos in evaluation loop (enabled by
  default on supported compilers)
  --with(out)-ensurepip=[=upgrade]
  "install" or "upgrade" using bundled pip
  --with-openssl=DIR  root of the OpenSSL directory
  --with-ssl-default-suites=[python|openssl|STRING]
  Override default cipher suites string, python: use
  Python's preferred selection (default), openssl:
  leave OpenSSL's defaults untouched, STRING: use a
  custom string, PROTOCOL_SSLv2 ignores the setting

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw


New submission from anthony shaw :

I've noticed that ./configure --help is inconsistent.

- The way default values are shared
- The way enumerated 
- The verbs used (e.g. enable, set)
- Some --with-xyx and some --with(out-xyz)
- Some start with capitals, others don't

Also, many of the flags could use additional explanation as to their purpose, 
or reference the rST file in the doc that explains what they do.

PR to follow

--
components: Build
messages: 359014
nosy: anthony shaw
priority: normal
severity: normal
status: open
title: ./configure --help has inconsistencies in style

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39156] Break up COMPARE_OP into logically distinct operations.

2019-12-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Introducing new opcodes will complicate the compiler.

And it will complicate opcode.py and peephole.c and anything else that touches 
the word codes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39158] ast.literal_eval() doesn't support empty sets

2019-12-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> set() is neither literal nor container display.

Yes, that is obvious.  However, we do support sets and set() is how make an 
empty set.   

It is weird to support sets but not empty sets, especially when it is so easy 
to do so safely.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39159] Ideas for making ast.literal_eval() usable

2019-12-29 Thread Raymond Hettinger


New submission from Raymond Hettinger :

A primary goal for ast.literal_eval() is to "Safely evaluate an expression node 
or a string".

In the context of a real application, we need to do several things to make it 
possible to fulfill its design goal:

1) We should document possible exceptions that need to be caught.  So far, I've 
found TypeError, MemoryError, SyntaxError, ValueError.

2) Define a size limit guaranteed not to give a MemoryError.  The smallest 
unsafe size I've found so far is 301 characters:

 s = '(' * 100 + '0' + ',)' * 100
 literal_eval(s)# Raises a MemoryError

3) Consider writing a standalone expression compiler that doesn't have the same 
small limits as our usual compile() function.  This would make literal_eval() 
usable for evaluating tainted inputs with bigger datasets. (Imagine if the json 
module could only be safely used with inputs under 301 characters).

4) Perhaps document an example of how we suggest that someone process tainted 
input:

 expr = input('Enter a dataset in Python format: ')
 if len(expr) > 300:
error(f'Maximum supported size is 300, not {len(expr)}')
 try:
data = literal_eval(expr)
 except (TypeError, MemoryError, SyntaxError, ValueError):
error('Input cannot be evaluated')

--
messages: 359011
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Ideas for making ast.literal_eval() usable

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39158] ast.literal_eval() doesn't support empty sets

2019-12-29 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39158] ast.literal_eval() doesn't support empty sets

2019-12-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

set() is neither literal nor container display.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39156] Break up COMPARE_OP into logically distinct operations.

2019-12-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Few years ago I experimented with a special opcode for exception matching. It 
could make the bytecode a tiny bit smaller and faster, but since catching an 
exception in Python is relatively expensive, it would not have significant 
performance benefit.

As for splitting COMPARE_OP for comparison, identity and containment tests, all 
these operations look the same from the compiler side, they correspond the same 
AST node. Introducing new opcodes will complicate the compiler.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39158] ast.literal_eval() doesn't support empty sets

2019-12-29 Thread Batuhan


Change by Batuhan :


--
nosy: +BTaskaya
type:  -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39158] ast.literal_eval() doesn't support empty sets

2019-12-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch
pull_requests: +17184
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17742

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39153] Clarify refcounting semantics of PyDict_SetItem[String]

2019-12-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The documentation for PyList_SetItem is explicit because its behavior is an 
exception from common rule and differs from PyList_SET_ITEM, so both should be 
documented explicitly.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39158] ast.literal_eval() doesn't support empty sets

2019-12-29 Thread Raymond Hettinger


New submission from Raymond Hettinger :

We already support sets but not empty sets.  After the PR, this now works:

>>> from ast import literal_eval
>>> literal_eval('set()')
set()

If we wanted, it would be a simple matter to extend it frozensets:

>>> literal_eval('frozenset({10, 20, 30})')
frozenset({10, 20, 30})

--
components: Library (Lib)
messages: 359007
nosy: rhettinger
priority: normal
severity: normal
status: open
title: ast.literal_eval() doesn't support empty sets
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39157] test_pidfd_send_signal can fail on some systems with PermissionError: [Errno 1] Operation not permitted

2019-12-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 8f0703ff92ed2d9ccd52d7e083c7bc26e732a428 by Pablo Galindo in 
branch 'master':
bpo-39157: Skip test_pidfd_send_signal if the system does not have enough 
privileges to use pidfd (GH-17740)
https://github.com/python/cpython/commit/8f0703ff92ed2d9ccd52d7e083c7bc26e732a428


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39156] Break up COMPARE_OP into logically distinct operations.

2019-12-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

When COMPARE_OP occurs in a loop, the dispatch tends to be branch predictable. 
So there may not be real-world performance benefit to splitting the opcodes.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39157] test_pidfd_send_signal can fail on some systems with PermissionError: [Errno 1] Operation not permitted

2019-12-29 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +17183
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17740

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39157] test_pidfd_send_signal can fail on some systems with PermissionError: [Errno 1] Operation not permitted

2019-12-29 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

==
FAIL: test_pidfd_send_signal (test.test_signal.PidfdSignalTest)
--
Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.x.pablogsal-arch-x86_64/build/Lib/test/test_signal.py", 
line 1287, in test_pidfd_send_signal
self.assertEqual(cm.exception.errno, errno.EBADF)
AssertionError: 1 != 9
-

Example failure:

https://buildbot.python.org/all/#/builders/231/builds/1/steps/5/logs/stdio

We should skip the test if the syscall is not permitted

--
messages: 359004
nosy: pablogsal
priority: normal
severity: normal
status: open
title: test_pidfd_send_signal can fail on some systems with PermissionError: 
[Errno 1] Operation not permitted

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39156] Break up COMPARE_OP into logically distinct operations.

2019-12-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I think is a good idea, being the only problem that I see that as the opcode 
targets are limited we would be burning 3 more. I specially like the proposal 
for JUMP_IF_NOT_EXC_MATCH as PyCmp_EXC_MATCH is only used in the code for the 
try-except and is always followed by a POP_JUMP_IF_FALSE.

As a curiosity, it would be good to have an idea on performance gains of 
specializing the comparison.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39156] Break up COMPARE_OP into logically distinct operations.

2019-12-29 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38870] Expose ast.unparse in the ast module

2019-12-29 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +17182
pull_request: https://github.com/python/cpython/pull/17739

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39156] Break up COMPARE_OP into logically distinct operations.

2019-12-29 Thread Mark Shannon


New submission from Mark Shannon :

Currently the COMPARE_OP instruction performs one of four different tasks.
We should break it up into four different instructions, that each performs only 
one of those tasks.

The four tasks are:
  Rich comparison (>, <, ==, !=, >=, <=)
  Identity comparison (is, is not)
  Contains test (in, not in)
  Exception matching

The current implementation involves an unnecessary extra dispatch to determine 
which task to perform.
Comparisons are common operations, so this extra call and unpredictable branch 
has a cost.

In addition, testing for exception matching is always followed by a branch, so 
the test and branch can be combined.

I propose adding three new instructions and changing the meaning of 
`COMPARE_OP`.

COMPARE_OP should only perform rich comparisons, and should call 
`PyObject_RichCompare` directly.
IS_OP performs identity tests, performs no calls and cannot fail.
CONTAINS_OP tests for 'in and 'not in' and should call `PySequence_Contains` 
directly.
JUMP_IF_NOT_EXC_MATCH Tests whether the exception matches and jumps if it does 
not.

--
components: Interpreter Core
messages: 359002
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Break up COMPARE_OP into logically distinct operations.
type: performance
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38870] Expose ast.unparse in the ast module

2019-12-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 23a226bf3ae7b462084e899d007d12d9fe398ac5 by Pablo Galindo in 
branch 'master':
bpo-38870: Run always tests that heavily use grammar features in test_unparse 
(GH-17738)
https://github.com/python/cpython/commit/23a226bf3ae7b462084e899d007d12d9fe398ac5


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39114] Python 3.9.0a2 changed how finally/return is traced

2019-12-29 Thread Mark Shannon


Mark Shannon  added the comment:

With PR 17737 the bytecode is:

  2   0 SETUP_FINALLY   16 (to 18)

  3   2 POP_BLOCK

  5   4 LOAD_GLOBAL  0 (a)
  6 LOAD_METHOD  1 (append)
  8 LOAD_CONST   1 (16)
 10 CALL_METHOD  1
 12 POP_TOP

  3  14 LOAD_CONST   2 (14)
 16 RETURN_VALUE

  5 >>   18 LOAD_GLOBAL  0 (a)
 20 LOAD_METHOD  1 (append)
 22 LOAD_CONST   1 (16)
 24 CALL_METHOD  1
 26 POP_TOP
 28 RERAISE
 30 LOAD_CONST   0 (None)
 32 RETURN_VALUE

--
keywords:  -patch
stage: patch review -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38870] Expose ast.unparse in the ast module

2019-12-29 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +17181
pull_request: https://github.com/python/cpython/pull/17738

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39114] Python 3.9.0a2 changed how finally/return is traced

2019-12-29 Thread Mark Shannon


Change by Mark Shannon :


--
keywords: +patch
pull_requests: +17180
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17737

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5851] Add a stream parameter to gc.set_debug

2019-12-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am going to close this for now as per my last comment (I think gc callbacks 
are best suited for custom statistics and custom behaviour when emitting the 
statistics - and more importantly, safer -) but feel free to re-open if you 
still think we didn't consider something important.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39114] Python 3.9.0a2 changed how finally/return is traced

2019-12-29 Thread Mark Shannon


Mark Shannon  added the comment:

Exammining the bytecode for:

def finally_return():
try:
return 14
finally:
a.append(16)

We have:

  2   0 SETUP_FINALLY   16 (to 18)

  3   2 POP_BLOCK

  5   4 LOAD_GLOBAL  0 (a)
  6 LOAD_METHOD  1 (append)
  8 LOAD_CONST   1 (16)
 10 CALL_METHOD  1
 12 POP_TOP

  3  14 LOAD_CONST   2 (14)

  5  16 RETURN_VALUE
>>   18 LOAD_GLOBAL  0 (a)
 20 LOAD_METHOD  1 (append)
 22 LOAD_CONST   1 (16)
 24 CALL_METHOD  1
 26 POP_TOP
 28 RERAISE
 30 LOAD_CONST   0 (None)
 32 RETURN_VALUE

Which looks correct, except for the line number of the first RETURN_VALUE.

Looking at the compiler it seems that we aren't preserving the original line 
number when emitting code for the finally block.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39154] "utf8" not always a synonym for "utf-8" in lib2to3

2019-12-29 Thread Peter Ludemann


Peter Ludemann  added the comment:

(oops -- updated this bug instead of submitting a new one)
See also https://bugs.python.org/issue39155

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39155] "utf8-sig" missing from codecs (inconsistency)

2019-12-29 Thread Peter Ludemann


New submission from Peter Ludemann :

In general, 'utf8' and 'utf-8' are interchangeable in the codecs (and in many 
parts of the Python library). However, 'utf8-sig' is missing ... and it happens 
to also be generated by lib2to3.tokenize.detect_encoding.

>>> import codecs
>>> codecs.getincrementaldecoder('utf-8-sig')()

>>> codecs.getincrementaldecoder('utf8-sig')()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/codecs.py", line 987, in getincrementaldecoder
decoder = lookup(encoding).incrementaldecoder
LookupError: unknown encoding: utf8-sig

--
components: Unicode
messages: 358996
nosy: Peter Ludemann, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: "utf8-sig" missing from codecs (inconsistency)
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39154] "utf8" not always a synonym for "utf-8" in lib2to3

2019-12-29 Thread Peter Ludemann


Peter Ludemann  added the comment:

lib2to3.tokenize should allow 'utf8' and 'utf-8' interchangeably, to be 
consistent with the rest of the Python library (I looked through the library 
source, and there seems to be no consistent preference, and also many (but not 
all) checks for 'utf-8' also check for 'utf8'). In particular, 
tokenize.detect_encoding should have code for both forms, as the encoding can 
be set by the user. Also, code should allow for 'UTF8' and 'UTF-8'.

See also https://bugs.python.org/issue39154

(This is probably a larger issue than just lib2to3, as a quick grep through 
/usr/lib/python3.7 showed; but not sure how to best address that.)

--
components: +2to3 (2.x to 3.x conversion tool) -Unicode
title: "utf8-sig" missing from codecs (inconsistency) -> "utf8" not always a 
synonym for "utf-8" in lib2to3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39154] "utf8-sig" missing from codecs (inconsistency)

2019-12-29 Thread Peter Ludemann


New submission from Peter Ludemann :

In general, 'utf8' and 'utf-8' are interchangeable in the codecs (and in many 
parts of the Python library). However, 'utf8-sig' is missing ... and it happens 
to also be generated by lib2to3.tokenize.detect_encoding.

>>> import codecs
>>> codecs.getincrementaldecoder('utf-8-sig')()

>>> codecs.getincrementaldecoder('utf8-sig')()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/codecs.py", line 987, in getincrementaldecoder
decoder = lookup(encoding).incrementaldecoder
LookupError: unknown encoding: utf8-sig

--
components: Unicode
messages: 358994
nosy: Peter Ludemann, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: "utf8-sig" missing from codecs (inconsistency)
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24174] Python crash on exit

2019-12-29 Thread SilentGhost

SilentGhost  added the comment:

Currently lollypop seems to be residing at 
https://gitlab.gnome.org/World/lollypop
However, this issue is filled against a no longer supported version which along 
with many changes in the C code warrants out-of-date closure, I think. Cédric, 
please re-open this issue if you're still experiencing this crash on a recent 
Python version.

--
nosy: +SilentGhost
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5851] Add a stream parameter to gc.set_debug

2019-12-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am not convinced about this. One of the problems I dislike is that the gc 
will take permanent ownership of the file descriptor (so is basically leaked). 
Is also not clear how this will behave during the delicate stages of 
finalization (the stream object provided can be anything that we have no 
control over during finalization) and also, it makes it a bit riskier as this 
can execute arbitrary python code in the middle of the gc.

On the other hand, is possible to use the gc callbacks to gather similar 
statistics about collections doing whatever you need there (like writing to 
file descriptors and the such).

--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39151] Simplify the deep-first-search of the assembler

2019-12-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> The code that orders blocks for output should not make assumptions about the 
> shape of the CFG, IMO.

I very much agree with this but notice that technically this function is doing 
it already if I am not mistaken. Following the b_next pointers in the first for 
loop already relies on the topological order in which they were emitted.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24174] Python crash on exit

2019-12-29 Thread Batuhan


Batuhan  added the comment:

The link you gave is broken, can you give a simple code to reproduce the issue?

--
nosy: +BTaskaya

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39151] Simplify the deep-first-search of the assembler

2019-12-29 Thread Mark Shannon


Mark Shannon  added the comment:

This seems correct, but your change assumes that there is no optimisation pass 
that reorders the blocks.
While the is currently true, it might not be in future.

The code that orders blocks for output should not make assumptions about the 
shape of the CFG, IMO.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39153] Clarify refcounting semantics of PyDict_SetItem[String]

2019-12-29 Thread Nick Coghlan


Change by Nick Coghlan :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
stage:  -> needs patch
type:  -> enhancement
versions: +Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39153] Clarify refcounting semantics of PyDict_SetItem[String]

2019-12-29 Thread Nick Coghlan


New submission from Nick Coghlan :

The documentation for PyList_SetItem is explicit that it steals a reference to 
the passed in value, and drops the reference for any existing entry: 
https://docs.python.org/3.3/c-api/list.html?highlight=m#PyList_SetItem

The documentation for PyDict_SetItem leaves the semantics unspecified, forcing 
the reader to either make assumptions, or else go read the source code (as was 
done for the SO answer at 
https://stackoverflow.com/questions/40700251/reference-counting-using-pydict-setitemstring)

Since the default assumption is actually correct, I don't think a Sphinx note 
is warranted, but an extra explicit sentence would be helpful.

PySequence_SetItem has such a sentence already: "This function does *not* steal 
a reference to v."

My suggestion is that we also add that sentence to the documentation for:

* PyObject_SetItem
* PyMapping_SetItemString
* PyDict_SetItem
* PyDict_SetItemString

--
messages: 358988
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Clarify refcounting semantics of PyDict_SetItem[String]

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2019-12-29 Thread Giovanni Lombardo


New submission from Giovanni Lombardo :

The issue arises by simply calling configure on the Scale widget of the themed 
tk (ttk) widgets set:

```
cursor = scale.configure('cursor')[-1]
```

The above casues the following error:

```
File "C:\Users\Giovanni\Tests\test_scale.py", line 604, in main
cursor = scale.configure('cursor')[-1]
File 
"C:\Users\Giovanni\AppData\Local\Programs\Python\Python37\lib\tkinter\ttk.py", 
line 1090, in configure
kw.update(cnf)
ValueError: dictionary update sequence element #0 has length 1; 2 is required
```

The interpreter is:

```
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit 
(AMD64)] on win32```

--
components: Tkinter
messages: 358987
nosy: glombardo
priority: normal
severity: normal
status: open
title: Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure
type: crash
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39145] Innocuous parent class changes multiple inheritance MRO

2019-12-29 Thread Mark Dickinson


Mark Dickinson  added the comment:

> You can close again if you feel this isn't a bug.

Yep, it's still not a bug. As Steven said, Python is correctly (modulo 
undiscovered bugs) implementing the C3 algorithm, and the C3 algorithm does 
indeed fail in this case.

--
nosy: +mark.dickinson
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38588] Use-after-free in dict/list

2019-12-29 Thread Dong-hee Na


Change by Dong-hee Na :


--
keywords: +patch
pull_requests: +17179
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17734

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5851] Add a stream parameter to gc.set_debug

2019-12-29 Thread Batuhan


Batuhan  added the comment:

@nicdumz are you still interested in this issue?

--
nosy: +BTaskaya

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com