[issue36707] The "m" ABI flag of SOABI for pymalloc is no longer needed

2019-04-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If --with-pymalloc does not impact the API, why we need this option?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue36689] docs: os.path.commonpath raises ValueError for different drives

2019-04-23 Thread Patrick Artman


Patrick Artman  added the comment:

If this isn't taken I'd be happy to give it a go as my first contribution

--
nosy: +pjartman

___
Python tracker 

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



[issue9633] pdb go stack up/down

2019-04-23 Thread daniel hahler


Change by daniel hahler :


--
nosy: +blueyed

___
Python tracker 

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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-23 Thread Brian Skinn


Brian Skinn  added the comment:

Thank you for taking the time to dig into it so deeply!

--

___
Python tracker 

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



[issue5215] change value of local variable in debug

2019-04-23 Thread daniel hahler


daniel hahler  added the comment:

This works however (Python 3.7), but is just buggy in pdbpp (another project).

--

___
Python tracker 

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



[issue36697] inspect.getclosurevars returns wrong globals dict

2019-04-23 Thread Noitul


Noitul  added the comment:

Look at this 
https://github.com/python/cpython/blob/3.6/Lib/inspect.py#L1412

We are taking names from func.__code__.co_names, which also contains names of 
object's attributes we visited. As a result, we may get more names unexpectedly 
in 'globals', 'builtins', and even 'unbound'.

And this example might be another case of this potentially bug

>>> import inspect
>>> def abc():
... import os
... sys = None
... 
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={}, builtins={}, unbound={'os'})

--

___
Python tracker 

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



[issue5215] change value of local variable in debug

2019-04-23 Thread daniel hahler


daniel hahler  added the comment:

@Andrei
That is something different, caused by "y" only being defined later.
But it would be nice if it would work.  Should be a separate/new issue though.

--
nosy: +blueyed

___
Python tracker 

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



[issue36639] Provide list.rindex()

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue36639] Provide list.rindex()

2019-04-23 Thread 林自均

林自均  added the comment:

>From the discussion in 
>https://mail.python.org/pipermail/python-ideas/2019-April/056416.html, Guido 
>said:

> Some use cases for rindex() on strings that I found in a large codebase
here include searching a pathname for the final slash, a list of
comma-separated items for the last comma, a fully-qualified module name for
the last period, and some ad-hoc parsing of other things. The "last
separator" use cases are the most common and here rindex() sounds very
useful.

I guess that's strong enough.

--

___
Python tracker 

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



[issue36465] Make release and debug ABI compatible

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
title: No longer enable Py_TRACE_REFS by default in debug build -> Make release 
and debug ABI compatible

___
Python tracker 

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



[issue36465] No longer enable Py_TRACE_REFS by default in debug build

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

I started a thread on python-dev to discuss this issue:
"[Python-Dev] Use C extensions compiled in release mode on a Python compiled in 
debug mode"
https://mail.python.org/pipermail/python-dev/2019-April/157178.html

It's a follow-up of my previous thread:
"[Python-Dev] No longer enable Py_TRACE_REFS by default in debug build"
https://mail.python.org/pipermail/python-dev/2019-April/157015.html

--

___
Python tracker 

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



[issue36707] The "m" ABI flag of SOABI for pymalloc is no longer needed

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

I modified PyObject_MALLOC and other macros when I implemented the PEP 445 "Add 
new APIs to customize Python memory allocators":
https://www.python.org/dev/peps/pep-0445/

ABI tags are defined by the PEP 3149:
https://www.python.org/dev/peps/pep-3149/#proposal
"--with-pymalloc (flag: m)"

The PEP 393 already made "--with-wide-unicode (flag: u)" useless in Python 3.3.

--

___
Python tracker 

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



[issue36707] The "m" ABI flag of SOABI for pymalloc is no longer needed

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +12856
stage:  -> patch review

___
Python tracker 

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



[issue36707] The "m" ABI flag of SOABI for pymalloc is no longer needed

2019-04-23 Thread STINNER Victor


New submission from STINNER Victor :

In Python 2.7, the WITH_PYMALLOC define (defined by ./configure --with-pymalloc 
which is the default) modified the Python API. For example, PyObject_MALLOC() 
is a macro replaced with PyObject_Malloc() with pymalloc but replaced with 
PyMem_MALLOC() without pymalloc.

In Python 3.8, it's no longer the case, PyObject_MALLOC is no longer modified 
by WITH_PYMALLOC, it's always an alias to PyObject_Malloc() for backward 
compatibility.

#define PyObject_MALLOC   PyObject_Malloc

More generally, WITH_PYMALLOC has no impact on the Python headers nor on the 
ABI in any way. Memory allocators can be switched at runtime using PYTHONMALLOC 
environment variable and -X dev command line option. For example, 
PYTHONMALLOC=malloc disables pymalloc (forces the usage of malloc() of the C 
library).

I propose attached PR which removes the "m" flag from SOABI in Python 3.8 when 
pymalloc is enabled.

--
messages: 340748
nosy: vstinner
priority: normal
severity: normal
status: open
title: The "m" ABI flag of SOABI for pymalloc is no longer needed
versions: Python 3.8

___
Python tracker 

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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-23 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the update and report, Brian.

--

___
Python tracker 

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



[issue36454] test_time: test_monotonic() failed on AMD64 FreeBSD 10-STABLE Non-Debug 3.7

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> 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



[issue36465] No longer enable Py_TRACE_REFS by default in debug build

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

Since my goal here is to support a C extension compiled in release mode on a 
Python compiled in debug mode, Py_TRACE_REFS should be a new separated ABI 
since it modify Py_INCREF/Py_DECREF. Maybe a new configure option should be 
added to opt-in for Py_TRACE_REFS and add "t" (T stands for Trace references) 
to SOABI.

--

___
Python tracker 

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



[issue36454] test_time: test_monotonic() failed on AMD64 FreeBSD 10-STABLE Non-Debug 3.7

2019-04-23 Thread miss-islington


miss-islington  added the comment:


New changeset e1a6cf2824acb43dc80473e0d938db99856daa97 by Miss Islington (bot) 
in branch '3.7':
bpo-36454: Fix test_time.test_monotonic() (GH-12929)
https://github.com/python/cpython/commit/e1a6cf2824acb43dc80473e0d938db99856daa97


--
nosy: +miss-islington

___
Python tracker 

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



[issue36454] test_time: test_monotonic() failed on AMD64 FreeBSD 10-STABLE Non-Debug 3.7

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d246a6766b9d8cc625112906299c4cb019944300 by Victor Stinner in 
branch 'master':
bpo-36454: Fix test_time.test_monotonic() (GH-12929)
https://github.com/python/cpython/commit/d246a6766b9d8cc625112906299c4cb019944300


--

___
Python tracker 

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



[issue36454] test_time: test_monotonic() failed on AMD64 FreeBSD 10-STABLE Non-Debug 3.7

2019-04-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12855

___
Python tracker 

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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-23 Thread Brian Skinn


Change by Brian Skinn :


--
resolution:  -> not a bug
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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-23 Thread Brian Skinn


Brian Skinn  added the comment:

It looks to me like it's a standard feature of the CPython string rendering 
routines, where if single and double quotes are present in any string, the 
preferred rendering is enclosure with single quotes with escaped internal 
single quotes.

On 3.6.6, regardless how I enter the following, it always returns enclosed in 
single quotes:

>>> """ ' " """
' \' " '

>>> ''' ' " '''
' \' " '

>>> ' \' " '
' \' " '

>>> " ' \" "
' \' " '

For my particular situation, then, the problem is that my warning message, as 
it sits in the source, consists of a double-quoted string that contains single 
quotes.  Then, when 3.8 doctest goes to print the source line, it has to print 
a string containing both single and double quotes, so the above default 
rendering rule kicks in and it gets printed with enclosing single-quotes. For 
3.7 doctest, where the regex doesn't match, the source line doesn't get 
printed, and so the resulting string contains no double quotes, and thus the 
string gets printed with enclosing double quotes.

Clearly, the solution is just for me to change the warning message! And indeed, 
changing to `warnings.warn("foo has no bar")` and updating the expected result 
to `'...UserWarning: foo has no bar\n...'` yields a passing test on both 3.7 
and 3.8 now.

--

___
Python tracker 

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



[issue36700] base64 has old references that should be updated

2019-04-23 Thread Paul Hoffman


Paul Hoffman  added the comment:

We can update the references without supporting every mode given in the new 
document. It is common for people to support RFC X without supporting every 
possible option of RFC X.

Having said that, I think adding extended hex makes good sense, if possible.

--

___
Python tracker 

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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-23 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I did some more debugging. doctest patches linecache which does some regex 
matching when filename is of the form [examplenumber]> to 
return example source. Before the commit seems absolute path was present in 
warning and hence this regex didn't match. With the commit returning the 
filename of this format that matches the regex the example line is again 
returned. This happens with warnings inside doctest because doctest patches 
linecache which is used by warnings.py during formatting the warning. In 
CPython for some reason presence of both single quote and double quote inside a 
triple quoted string causes the single quote to be escaped. Any concatenation 
with the escaped triple quoted string also escapes the resulting text. doctest 
seems to store the examples as single quoted strings that are escaped and 
escaping them during _formatwarnmsg_impl causes the other one also to be 
escaped. It also happens with a normal string that has an escaped double quote.

>>> a = """Test '' b""" # Two single quotes
>>> a
"Test '' b"
>>> a = """Test " b'""" # One single and double quote
>>> a
'Test " b\''
>>> a + "'c'"
'Test " b\'\'c\''
>>> a = """Test ' b"""  # Only single quote
>>> a
"Test ' b"
 a + "'c'"
"Test ' b'c'"
 a = "Test ' b\""  # Escaped double quote
 a
'Test \' b"'
 a + "'a'"
'Test \' b"\'a\''

Does anyone know why this happens with escaped quotes and single quote being 
escaped? Is this expected and is it part of spec about how single and double 
quote are swapped over representation?

Longer explanation :

Take the below sample doctest file

$ cat ../backups/bpo36695.rst
>>> import warnings  # line 0
>>> warnings.warn("Test 'a'")  # line 1

doctest patches linecache.getlines to a custom function 
`__patched_linecache_getlines` [0]

linecache.getlines = __patched_linecache_getlines

__LINECACHE_FILENAME_RE = re.compile(r'.+)'
 r'\[(?P\d+)\]>$')
def __patched_linecache_getlines(self, filename, module_globals=None):
 m = self.__LINECACHE_FILENAME_RE.match(filename)
 if m and m.group('name') == self.test.name:
  example = self.test.examples[int(m.group('examplenum'))]
  return example.source.splitlines(keepends=True)
 else:
  return self.save_linecache_getlines(filename, module_globals)

doctest forms a special filename as below that is passed to exec(compile()) and 
hence as per the commit warning is now raised as the filename "" in the warning. doctest also mocks sys.stdout internally to 
have the output captured to a StringIO buffer. [1]

# Use a special filename for compile(), so we can retrieve
# the source code during interactive debugging (see
# __patched_linecache_getlines).
filename = '' % (test.name, examplenum)

# Before commit

   cpython git:(3b0b90c8c3) ./python.exe -m doctest ../backups/bpo36695.rst
/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/doctest.py:1: 
UserWarning: Test 'a'
  # Module doctest.

# After commit

$cpython git:(11a896652e) ./python.exe -m doctest ../backups/bpo36695.rst
:1: UserWarning: Test 'a'
  warnings.warn("Test 'a'")

formatting warning message [2] calls linecache.getline with filename as 
"" after commit which in turn calls linecache.getlines 
that is patched above by doctest and hence it matches the regex and returns the 
example.source "warnings.warn("Test 'a'")". It seems to be a triple quoted 
string that is already escaped and hence in the below line calling s += " %s\n" 
% line causes the actual warning message and the example source line to be 
escaped.

  def _formatwarnmsg_impl(msg):
s =  ("%s:%s: %s: %s\n"
  % (msg.filename, msg.lineno, msg.category.__name__,
 msg.message))

if msg.line is None:
try:
import linecache
line = linecache.getline(msg.filename, msg.lineno)
except Exception:
# When a warning is logged during Python shutdown, linecache
# and the import machinery don't work anymore
line = None
linecache = None
else:
line = msg.line
if line:
line = line.strip()
s += "  %s\n" % line

[0] 
https://github.com/python/cpython/blob/29d018aa63b72161cfc67602dc3dbd386272da64/Lib/doctest.py#L1468
[1] 
https://github.com/python/cpython/blob/29d018aa63b72161cfc67602dc3dbd386272da64/Lib/doctest.py#L1452
[2] 
https://github.com/python/cpython/blob/29d018aa63b72161cfc67602dc3dbd386272da64/Lib/warnings.py#L35

--

___
Python tracker 

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



[issue36700] base64 has old references that should be updated

2019-04-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See issue16995.

--

___
Python tracker 

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



[issue36700] base64 has old references that should be updated

2019-04-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

base64 supports RFC 3548, but not RFC 4648.

=
13.  Changes Since RFC 3548

   Added the "base32 extended hex alphabet", needed to preserve sort
   order of encoded data.

   Referenced IMAP for the special Base64 encoding used there.

   Fixed the example copied from RFC 2440.

   Added security consideration about providing a signature for
   cryptoanalysis.

   Added test vectors.

   Fixed typos.
=

To support RFC 4648 we need to add support for base 32 encoding with extended 
hex alphabet (see 16995). Check also that RFC 4648 test vectors are used in the 
module tests.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue22107] tempfile module misinterprets access denied error on Windows

2019-04-23 Thread Billy McCulloch

Billy McCulloch  added the comment:

I stand by the patch file I previously submitted on 2016-05-04. A more detailed 
analysis / description of my reasoning follows.

Change 1 in _get_default_tempdir:
A PermissionError is thrown on Windows if you attempt to create a file whose 
filename matches an existing directory. As the code currently stands, the `if` 
statement checks whether the proposed file's *parent* directory is a directory 
(which it is, or a FileNotFoundError would have been thrown), instead of 
whether the proposed filename conflicts with an existing directory. The edited 
expression is really a typo that, in the context of the code block, always 
evaluates `True`.
Here’s what we’re now saying in the `if` block: when a PermissionError is 
raised, if we’re on Windows (the only currently supported platform to throw 
nonsense errors at us) AND the filename we chose simply conflicts with an 
existing directory AND we supposedly have write access to the parent directory, 
then we were just unlucky with the chosen name and should try again in the same 
parent directory. (I say supposedly because Windows seems to erroneously report 
True on this check, even when we don’t have write access. I wouldn’t be 
surprised if this last check does something useful in certain contexts, I just 
don’t know what they are.)

Change 2 in _mkstemp_inner:
Same as above for Change 1. While _get_default_tempdir uses this code block to 
make sure the system tempdir is really writable, and _mkstemp_inner does it so 
that a file descriptor can be returned, the result and arguments are the same.

Change 3 in mkdtemp:
For _get_default_tempdir and _mkstemp_inner, the blocks of code in question are 
creating temporary files. As such, they need to handle the oddball case for 
Windows where attempts to create a file with a filename which conflicts with an 
existing directory name result in a PermissionError. The same block of error 
handling code is copied in mkdtemp, even though this function never tries to 
create a file – it only tries to create a directory. As such, in the case that 
we try to create a directory with a name that already exists (whether as a file 
or a directory), we wouldn't be dealing with a PermissionError, we'd have a 
FileExistsError, which is already handled in mkdtemp by the preceding lines. 
The only way I’ve seen a PermissionError crop up for a call to mkdir on Windows 
is if the user doesn’t have permission to create filesystem objects in the 
parent directory. This is the intended usage of a PermissionError, so no 
special handling needed is required. Remember, a PermissionError shouldn’t 
happen if mkdtemp is called without a `dir` kwarg, because the _sanitize_params 
will invoke _get_default_tempdir, which will check to ensure that the parent 
directory is writable. As such, this block of code was superfluous, and the 
patch should not raise PermissionError in user code where it previously was 
caught.

--

___
Python tracker 

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



[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Brett Cannon


Brett Cannon  added the comment:

I'm -1 on pulling `request` up to implicitly be part of the `urllib` namespace 
without an import. `os.path` is the only exception that I know of in the stdlib 
and that's historical (it predates packages existing in the language). 
Otherwise the proposed change is suggesting that we automatically import all 
submodules to the top of a package which is expensive (as Martin pointed out), 
and simply not how Python's import is meant to be used.

And the statement that "`request` is part of `urllib`" is true today, just like 
saying any submodule is part of a package. If that wording is confusing then a 
PR to tweak the wording could be considered.

Since there are 3 core devs who are against this idea I'm closing this as "not 
a bug". Thanks for the idea regardless, Piyush!

--
resolution:  -> not a bug
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



[issue36624] cleanup the stdlib and tests with regard to sys.platform usage

2019-04-23 Thread Steve Dower


Steve Dower  added the comment:

> Being 'runtime' rather than 'buildtime' seemed more precise - tests that
> are not meant to be build-time dependent use run-time status while
> leaving sys.platform for concerns that are directly related to builds

This is a good point - perhaps we need both?

Many of the current test skips are related to build-time switches, but indeed, 
some relate to the runtime environment.

One aspect I'm keeping in mind here is that with the Windows Subsystem for 
Linux, many lines are becoming blurred with respect to which build of Python 
people are using (I'm already getting bug reports from people who thought they 
were getting the Windows build but actually the Linux one, or vice versa). And 
mismatching builds causes some weird problems. Being able to clearly identify 
"Windows build + WSL environment" or "Linux build + WSL environment" will 
likely matter more over time.

It would be nice to have all the checks centralized, perhaps a set of 
decorators in a test.requires module?

@test.requires.linux_platform
@test.requires.darwin_platform
@test.requires.macos_runtime(10, 9)
def test_my_test(self): ...

(It would require some clever decorator design, but we can make those work like 
"ORs" rather than "ANDs".)

Does it provide any benefit? I think it's clever, but that doesn't mean it's 
worthwhile :) Using skipIf and skipUnless with test.support.CONSTANTS is just 
as readable and just as obvious (once we're using them consistently).



--

___
Python tracker 

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



[issue36454] test_time: test_monotonic() failed on AMD64 FreeBSD 10-STABLE Non-Debug 3.7

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +12854
stage:  -> patch review

___
Python tracker 

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



[issue36635] Add _testinternalcapi module

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> 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



[issue22135] allow to break into pdb with Ctrl-C for all the commands that resume execution

2019-04-23 Thread Chun-Yu Tseng


Chun-Yu Tseng  added the comment:

My bad, I totally forget this patch. Need to spend some time to retest my code 
and catch up with current development flow. Thanks for reminding.

--

___
Python tracker 

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



[issue36658] Py_Initialze() throws error 'unable to load the file system encoding' when calling Py_SetPath with a path to a directory

2019-04-23 Thread Steve Dower


Steve Dower  added the comment:

Glad to hear it.

Hopefully as we redesign the embedding initialization APIs this kind of problem 
will become easier to solve (it's certainly one of my concerns with the current 
API).

--
resolution:  -> not a bug
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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

To come back to RPATH vs RUNPATH: these 2 are very different in term of 
priorities in search (see other comments).

distutils uses an heuristic to opt-in for RUNPATH using GNU ld 
--enable-new-dtags option. This option is only used if the following 3 
conditions are met:

(1) the OS is not macOS, not FreeBSD, nor HP-UX
(2) the C compiler is detected as GCC
(3) Python detected the linker as being GNU ld

Problem: the heuristic is not very reliable:

(3) only checks the linker when Python is build, it's implemented as: 
sysconfig.get_config_var("GNULD") == "yes". In practice, the linker can be 
changed at runtime using environment variables and so Python may miss the 
oportunity for opt-in for --enable-new-dtags, or pass this option which is 
unknown to another linker.

(2) The detection of GCC checks for "gcc" or "g++" string if the name of the 
compiler program name. If you use "cc", it's not detected as GCC.

I'm not sure that these 2 problems are real problems "in practice".

My main concern is that you might get RPATH or RUNPATH depending on operating 
system, the C compiler and the linker, whereas RPATH semantics is very 
different from RUNPATH semantics (search priority).

--

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

Ratione from my colleague Carlos O'Donell:
"The intent of this patch is to remove the default search paths of the dynamic 
loader from DT_RPATH/DT_RUNPATH. This allows the default system paths to be 
searched last as is expected by most programs, and enables LD_LIBRARY_PATH and 
cache searches to happen first. The patch does not forbid rpath in any form, 
but forbids promoting default system search paths in this way."

He added:

If you allow the default library paths in rpath, it bypasses the usual 
hierarchy of checks -> (a) DT_RPATH -> (b) LD_LIBRARY_PATH -> (c) DT_RUNPATH -> 
(d) cache -> (e) system defaults. Allowing /usr/lib64 in DT_RPATH moves that 
path from (e) -> (a). In terms of a search hierarchy.

It's not really the behaviour you want in the [Fedora/RHEL] distribution, you 
want the system defaults to be at the end of the search order instead of being 
promoted to early searches. The intent of the patch should be documented as 
such so we remember why we made the change. It's the same problem as adding 
/usr/lib64 to LD_LIBRARY_PATH, which on RHEL7 actually has a bug in some cases 
which can lead to crash.

--

___
Python tracker 

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



[issue36658] Py_Initialze() throws error 'unable to load the file system encoding' when calling Py_SetPath with a path to a directory

2019-04-23 Thread RimacV


RimacV  added the comment:

As you said, I just had to set all paths, when using Py_SetPath. 
>From my side this issue could be closed. 

Thank you! :-)

--
components: +Library (Lib) -Windows

___
Python tracker 

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



[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

In 2015, Robert Kuska proposed to remove the patch from Fedora:
"This check should be covered by rpmlint which MUST be run during the review so 
I propose to drop this patch."
https://bugzilla.redhat.com/show_bug.cgi?id=1287566#c1

But Toshio Ernie Kuratomi explained that the patch is a practical solution to 
avoid rpath on /usr/lib64 for all Fedora libraries (built by Python):
"I would recommend against dropping the patch.  Since it's only removing 
LIBDIR, it's removing an rpath that should never be needed (the dynamic linker 
will try LIBDIR on its own, no need for an rpath to make it do so).  The patch 
means that distutils does not add the unneeded rpath to any binaries it 
generates which is what that Debian page recommends (patch the build system).  
If we were to drop the patch, then package maintainers of C extensions would 
need to add boilerplate to their packages which strips the unnecessary rpath.  
Better to do that in a single place (the python package) if we can.

If you do decide to drop rpath, you should also coordinate updating all 
existing C extension packages to include the boilerplate removing rpath.  
Python packaging guidelines could also be updated to mention it (but not 
strictly necessary -- the rpath guidelines cover this... it would just be 
keeping the information in one place)."
https://bugzilla.redhat.com/show_bug.cgi?id=1287566#c2

--

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

I'm confused between RPATH and RUNPATH which are *different*.

When I configure Python using LDFLAGS="-Wl,-rpath=/opt/py38/lib/" (Python 
configure and Makefile), Python, libpython, and dynamic libraries ELF of C 
extensions get a RPATH.

When I use setup.py build_ext -rpath (distutils), dynamic libraries ELF of C 
extensions get a RUNPATH.

More details below.

--

When I build lxml using patched Fedora Python (/usr/bin/python3), I get:

$ python3 setup.py build_ext --rpath /custom/rpath
...
$ objdump -a -x 
build/lib.linux-x86_64-3.7/lxml/etree.cpython-37m-x86_64-linux-gnu.so|grep -Ei 
'rpath|runpath'
  RUNPATH  /custom/rpath

Note: when I use patched Fedora Python, "--rpath /usr/lib64" of "python3 
setup.py build_ext --rpath /usr/lib64" is ignored: the .so file doesn't have 
RPATH nor RUNPATH. That's the purpose of the patch.

--

When I built Python using ./configure --prefix /opt/py38 
LDFLAGS="-Wl,-rpath=/opt/py38/lib/" --enable-shared, I got:

$ objdump -a -x /opt/py38/bin/python3.8|grep -i rpath
  RPATH/opt/py38/lib/
$ objdump -a -x /opt/py38/lib/libpython3.8m.so|grep -i rpath
  RPATH/opt/py38/lib/

If I build lxml without an explicit rpath, it inherits the Python rpath:

$ LD_LIBRARY_PATH=/opt/py38/lib ./opt_env/bin/python setup.py build_ext 
$ objdump -a -x 
build/lib.linux-x86_64-3.8/lxml/etree.cpython-38m-x86_64-linux-gnu.so|grep -Ei 
'rpath|runpath'
  RPATH/opt/py38/lib/

If I build lxml with an explicit rpath, I get:

$ LD_LIBRARY_PATH=/opt/py38/lib ./opt_env/bin/python setup.py build_ext --rpath 
/custom/rpath
$ objdump -a -x 
build/lib.linux-x86_64-3.8/lxml/etree.cpython-38m-x86_64-linux-gnu.so|grep -Ei 
'rpath|runpath'
  RUNPATH  /opt/py38/lib/:/custom/rpath

--

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread Charalampos Stratakis


Change by Charalampos Stratakis :


--
nosy: +cstratak

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

> Since 2010, the Fedora packages of Python are using a patch on distutils 
> UnixCCompiler to remove standard library path from rpath. The patch has been 
> written by David Malcolm for Python 2.6.4: 
> https://src.fedoraproject.org/rpms/python2/c/f5df1f834310948b32407933e3b8713e1121105b

Hum, in fact the initial patch author is: Ignacio Vazquez-Abrams.

The commit message says:

"fixup distutils/unixccompiler.py to remove standard library path from rpath 
(patch 17)"

the specfile contains this comment:

# Fixup distutils/unixccompiler.py to remove standard library path from rpath:
# Adapted from Patch0 in ivazquez' python3000 specfile, removing usage of
# super() as it's an old-style class

"ivazquez" is Ignacio Vazquez-Abrams who wrote an early version of the Python 3 
specfile for Fedora and the rpath patch, but he stopped to contribute to Fedora 
around 2006. David Malcolm wrote the final specfile using Ignacio's patch.

--

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread Florian Weimer


Florian Weimer  added the comment:

Note that linking with -Wl,-rpath,/usr/lib64 (even if it's redundant) disables 
part of the ld.so cache on Linux.  Instead, paths under /usr/lib64 are probed 
explicitly.  This can add quite a few failing open/openat system calls to the 
process startup.

--

___
Python tracker 

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



[issue36704] logging.FileHandler currently hardcodes errors='strict'

2019-04-23 Thread Alan Jenkins


Alan Jenkins  added the comment:

> [**] dnf developers did not appear to work on the correctness issue they 
> found.  It might be a bug in gettext.

Nitpick: sorry, I read too quickly.  dnf *did* fix the specific correctness 
issue, as well as setting raiseExceptions = false.  It is explained by the PR 
description (and the diff)

https://github.com/rpm-software-management/dnf/pull/751

--

___
Python tracker 

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



[issue36705] Unexpected Behaviour of pprint.pprint

2019-04-23 Thread Fred L. Drake, Jr.


Fred L. Drake, Jr.  added the comment:

Eric nailed it; pprint was not designed as a replacement for print, and was 
never intended to serve that purpose.

Rejecting as out of scope.

--
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



[issue36706] Python script on startup stucks at import

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like you are using Linux. Please using strace to trace system calls to 
see where Python is stuck:

strace -tt -o trace python3 script.py

Once you reproduce the issue using strace, attach created "trace" file to this 
issue. "-tt" adds timestamp with millisecond resolution.

--
nosy: +vstinner

___
Python tracker 

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



[issue36705] Unexpected Behaviour of pprint.pprint

2019-04-23 Thread Eric V. Smith


Eric V. Smith  added the comment:

pprint.pprint is not designed to be a drop-in replacement for print. At this 
point, we cannot break existing code to change how pprint works.

I suggest you make a pprint.pprint wrapper that does what you want, or maybe 
subclass pprint.PrettyPrinter.

--
nosy: +eric.smith

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread Florian Weimer


Change by Florian Weimer :


--
nosy: +fweimer

___
Python tracker 

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



[issue36706] Python script on startup stucks at import

2019-04-23 Thread serge g

New submission from serge g :

I am not sure if it is python's issue (correct me if this is wrong place for 
report). But sometimes (probably every 3-4 attempt) when I run script, 
interpreter just stucks for some time (0.5-3 minutes) and then actually runs 
the script normally.

To figure out what happens I increased verbosity (python -vv) and actually 
python hangs on import on this line:

...
# trying 
/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/hazmat/primitives/kdf/scrypt.abi3.so
# trying 
/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/hazmat/primitives/kdf/scrypt.so
# trying 
/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/hazmat/primitives/kdf/scrypt.py
# 
/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-37.pyc
 matches 
/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/hazmat/primitives/kdf/scrypt.py
# code object from 
'/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-37.(pyc'
(here >) import 'cryptography.hazmat.primitives.kdf.scrypt' # 
<_frozen_importlib_external.SourceFileLoader object at 0x7f5c6e3c73c8>
import 'cryptography.hazmat.backends.openssl.backend' # 
<_frozen_importlib_external.SourceFileLoader object at 0x7f5c6c129c88>
import 'cryptography.hazmat.backends.openssl' # 
<_frozen_importlib_external.SourceFileLoader object at 0x7f5c6d30d240>
# trying 
/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/x509/UnsupportedExtension.cpython-37m-x86_64-linux-gnu.so
# trying 
/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/x509/UnsupportedExtension.abi3.so
# trying 
/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/x509/UnsupportedExtension.so
# trying 
/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/x509/UnsupportedExtension.py
# trying 
/home/2kg/spider/venv/lib/python3.7/site-packages/cryptography/x509/UnsupportedExtension.pyc
...

I had version 3.5 installed before and didn't notice such issue. Other scripts 
from my project suffer from this symptom as well.

My configuration is:
debian 9
python 3.7.3 [GCC 6.3.0 20170516] on linux
cryptography module – version 2.6.1

--
components: Library (Lib)
messages: 340722
nosy: serge g
priority: normal
severity: normal
status: open
title: Python script on startup stucks at import
type: performance
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



[issue36705] Unexpected Behaviour of pprint.pprint

2019-04-23 Thread Gavin D'souza


Gavin D'souza  added the comment:

if pprint is called without parameters, it returns a TypeError

>>> pprint()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: pprint() missing 1 required positional argument: 'object'

it would be beneficial however to return an empty string or a new line 
character instead. An erroneous call would generate an unnecessary run-time 
error in a huge script

--

___
Python tracker 

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



[issue36705] Unexpected Behaviour of pprint.pprint

2019-04-23 Thread Gavin D'souza


New submission from Gavin D'souza :

For a simple string input, pprint would be expected to return an output similar 
to print. However, the functionality differs

### Code:
import time
from pprint import pprint

start = time.time()
time.sleep(0.5)
object_made = time.time()
time.sleep(0.5)
done = time.time()
time.sleep(0.5)
shown = time.time()

pprint(
f"Time to create object: {object_made - start}s\n" +
f"Time to insert 10 rows: {done - object_made}s\n" +
f"Time to retrieve 10 rows: {shown - done}s\n"
)

### Output Received:
('Time to create object: 0.5010814666748047s\n'
 'Time to insert 10 rows: 0.5010972023010254s\n'
 'Time to retrieve 10 rows: 0.501101016998291s\n')

### Expected Output:
Time to create object: 0.5010814666748047s
Time to insert 10 rows: 0.5010972023010254s
Time to retrieve 10 rows: 0.501101016998291s

--
components: Library (Lib)
messages: 340720
nosy: Gavin D'souza, fdrake
priority: normal
severity: normal
status: open
title: Unexpected Behaviour of pprint.pprint
type: behavior
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



[issue18372] _Pickler_New() doesn't call PyObject_GC_Track(self)

2019-04-23 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> fixed
stage: patch review -> 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



[issue18372] _Pickler_New() doesn't call PyObject_GC_Track(self)

2019-04-23 Thread miss-islington


miss-islington  added the comment:


New changeset c0f6f5370325459cadd90010530b1d300dce514e by Miss Islington (bot) 
in branch '3.7':
bpo-18372: Add missing PyObject_GC_Track() calls in the pickle module (GH-8505)
https://github.com/python/cpython/commit/c0f6f5370325459cadd90010530b1d300dce514e


--
nosy: +miss-islington

___
Python tracker 

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



[issue18372] _Pickler_New() doesn't call PyObject_GC_Track(self)

2019-04-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12853

___
Python tracker 

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



[issue18372] _Pickler_New() doesn't call PyObject_GC_Track(self)

2019-04-23 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 359bd4f61b9e1493081f4f67882554247b53926a by Inada Naoki (Zackery 
Spytz) in branch 'master':
bpo-18372: Add missing PyObject_GC_Track() calls in the pickle module (GH-8505)
https://github.com/python/cpython/commit/359bd4f61b9e1493081f4f67882554247b53926a


--
nosy: +inada.naoki

___
Python tracker 

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



[issue36704] logging.FileHandler currently hardcodes errors='strict'

2019-04-23 Thread SilentGhost


Change by SilentGhost :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue36704] logging.FileHandler currently hardcodes errors='strict'

2019-04-23 Thread Alan Jenkins


New submission from Alan Jenkins :

## Problem description

```
import os
import logging

logging.basicConfig(filename='example.log',level=logging.DEBUG)
for name in os.listdir():
logging.error('Hypothetical syntax error at line 1 of file: 
{}'.format(name))
```

The above program is incorrect.[*]  Because it is liable to raise 
UnicodeEncodeError.  This can be reproduced on a standard UTF-8 locale by 
creating a filename which is not valid UTF-8, e.g. `touch $(printf '\xff')`. 
Plenty of arguments have been written on this topic, but this is not my problem.

The user can report the program error, and it should not be too hard to debug.  
And there is a fairly straightforward workaround, following Python's IOError: 
use repr() when outputing filenames.

But there is another issue with the above.  The docs advise that most programs 
deployed to production, will want to set `logging.raiseExceptions = false`.

My motivating example is the Linux package manager dnf, which followed this 
advice.  Specifically when they wanted to avoid UnicodeEncodeError.  [**][***]

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1303293#c17

I think UnicodeEncodeError is an important case to handle, but the logging 
module does not handle it in a good way.  When we have `logging.raiseExceptions 
= false`, the problem messages will be lost.  Those messages could be critical 
to troubleshooting the user's problem.  It is even possible that all messages 
are lost - I think this would be very frustrating to troubleshoot.


## Alternative solutions which have been considered

* All debugging problems could of course be avoided, by simply writing correct 
programs in the first place.  The existence of debuggers suggests this is not a 
practical answer, even for Python :-).

* FileHandler can be worked around fairly simply, using StreamHandler instead.  
However if you wanted to use RotatingFileHandler, there is no (documented) 
interface that would let you work around it.  SyslogHandler also seems 
important enough to be worth worrying about.


## A possible solution

When you set `raiseExceptions = false`, logging.FileHandler and friends should 
use errors='backslashreplace'.

errors='backslashreplace' is already the default for sys.stderr.  Matching this 
seems nice in case the program uses the default stderr logging in some 
configurations.

A log file full of encoding noise will be a specific sign, that can be used in 
troubleshooting.  And in cases similar to my example program, parts of the 
message could be entirely readable.  The end-user might be able to use the log 
message without noticing the incorrectness at all.  This is entirely consistent 
with the rationale for `logging.raiseExceptions = false`.

Previously you could set logging.raiseExceptions *after* you create the logger. 
 It will be a bit inconsistent if FileHandler relies on setting the `errors` 
parameter of `open()`.  It seems fairly easy to document this restriction.  But 
if that is not considered acceptable, we would either need some weird system 
that calls stream.reconfigure(), or muck around like dnf.i18n.UnicodeStream 
does:

try:
stream.write(s)
except UnicodeEncodeError:
if logging.raiseExceptions:
raise
else:
stream.flush()  # make sure nothing gets out of order!
s = s.encode(stream.encoding, 'backslashreplace')
stream.buffer.write(s)

---

[*] C programs which segfault are said to be incorrect (or there is an error in 
system software or hardware).  I am using similar phrasing for python programs 
which raise unhandled UnicodeError's.  I am not sure if it is a good phrase to 
use for a Python program, but I hope my overall point is fairly clear.

[**] dnf developers did not appear to work on the correctness issue they found. 
 It might be a bug in gettext.

[***] In the linked case, *none* of dnf's messages were readable.  But I 
sympathize that dnf is so critical, it seems useful for dnf to try and hobble 
along.  Even in cases like this one.  As the user attempts to work towards some 
desired end state...  The user might temporarily ignore the non-fatal problem 
in dnf, because their current problem seems more important, e.g. trying to 
install some software needed to recover or back up document files.  At best, 
they might know some diagnostic software that knows how to diagnose they have a 
locale problem :-).  Or more serendipitously, installing certain other software 
that also suffers a locale problem might help them realize what is happening.

--
components: Library (Lib)
messages: 340717
nosy: sourcejedi
priority: normal
severity: normal
status: open
title: logging.FileHandler currently hardcodes errors='strict'
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___

[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread Kubilay Kocak


Change by Kubilay Kocak :


--
nosy: +koobs

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

My understanding of Fedora 1-rpath.patch is that it ignores -rpath PATH 
option passed to the setup.py bdist command if PATH is equal to Python 
sysconfig LIBDIR variable. So it impacts how third party C extensions are 
built. On my Fedora, LIBDIR is set to:

$ python3 -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))"
/usr/lib64

Only LIBDIR directory is ignored: other -rpath directories are passed to the 
linker.

---

UnixCCompiler.link() has a runtime_library_dirs parameter which can be modified 
by the _fix_lib_args() method and then is passed to gen_lib_options().

gen_lib_options() calls compiler.runtime_library_dir_option() on each directory 
of runtime_library_dirs: this part is responsible to use the proper linker 
option: -R, -rpath, -L, etc.

build_ext.build_extension() method of distutils.commands.build_ext pass 
Extension.runtime_library_dirs to compiler.link_shared_object()

build_ext.check_extensions_list() modify the runtime_library_dirs attribute:

# Medium-easy stuff: same syntax/semantics, different names.
ext.runtime_library_dirs = build_info.get('rpath')

I understand that build_info.get('rpath') comes from -rpath command line option 
of setup.py bdist_ext command:

('rpath=', 'R',
 "directories to search for shared C libraries at runtime"),

--

___
Python tracker 

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



[issue36624] cleanup the stdlib and tests with regard to sys.platform usage

2019-04-23 Thread Michael Felt


Michael Felt  added the comment:

On 22/04/2019 21:14, Steve Dower wrote:
> Steve Dower  added the comment:
>
> I like this, though I don't like using the platform module here and would 
> prefer sys.platform to be canonical (until there's a need to differentiate - 
> e.g. some tests coming for Windows ARM32 will need to be more specific).

I thought I would try `platform` as that already seemed to be more
portable over different versions (e.g., linux3, linux4, linux5, aix4,
aix5, aix7 coming from sys.platform while platform.system() was already
'Linux' and 'AIX' respectively). Personally, it makes difference to me.
Being 'runtime' rather than 'buildtime' seemed more precise - tests that
are not meant to be build-time dependent use run-time status while
leaving sys.platform for concerns that are directly related to builds
(e.g., cross-platform-builds; when adding modules using eggs or pip
where the module may want a "build-platform" dependency; etc).

In either case - I do believe in a 'canonical' statement - that could be
(later) documented in a PEP (e.g., update to PEP 8 if that is also
applicable to test writing).

Looking forward - question - should the same canon be applied within the
core? Here is "merely" looking at Lib/test

>
> In general, I'd like fewer tests to be platform specific and make more 
> functionality "just work" across platforms, or at least platform families. I 
> feel like more precise skips don't actually help with that - they make it too 
> easy to say "this functionality just doesn't work here" instead of trying to 
> make it work.

Agreed. Although there shall always be some platform differences. Some
"platform functions" will be absent or at least different.

Not directly related perhaps, but is a function absent as a "platform"
function when it is only available after a third-party (aka "asis")
library is installed? I, personally, have a hard time identifying what
is really "core" - asin - must be present for Python to be Python,
versus must be present to support a more (or less) commonly used 'module'.

I'll wait a bit for any other comments - and I am curious about thoughts
for the platforms 'ignored', e.g., hpux, cygwin, vmax(?), and a few more.

Maybe the "common wisdom" is that the exceptions for the special
platforms that are here - should just be removed - looking forward.
Perhaps being restored because someone working on (supporting) that
platform requests it being restored. I would hope this would also help
to further clean up the tests.

>
> --
> nosy: +steve.dower
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-445902 which modified distutils to use "-Wl,-R " rather than 
"-R ".

--

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

I'm also confused by the diversity of ways to declare runtime paths. I found 
these linker flags related to rpath:

* -rpath=PATH
* -rpath-link=PATH
* -R FILENAME, --just-symbols=FILENAME: "Read symbol names and their addresses 
from FILENAME, (...). For compatibility with other ELF linkers, if the -R 
option is followed by a directory name, rather than a file name, it is treated 
as the -rpath option."
* --enable-new-dtags, --disable-new-dtags: "new dynamic tags in ELF"

configure and Makefile manipulates *compiler* flags, not *linker* flags, and so 
options like "-Wl,-rpath=PATH" is used: "-Wl,OPTION" pas OPTION as an option to 
the linker.

--

___
Python tracker 

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



[issue36696] possible multiple regressions on AIX

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
components: +Build
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8

___
Python tracker 

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



[issue36696] possible multiple regressions on AIX

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 574913479f26b5ff48827861bce68281be01d16e by Victor Stinner in 
branch 'master':
bpo-36635, bpo-36696: Fix setup.py on AIX (GH-12922)
https://github.com/python/cpython/commit/574913479f26b5ff48827861bce68281be01d16e


--

___
Python tracker 

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



[issue36635] Add _testinternalcapi module

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 574913479f26b5ff48827861bce68281be01d16e by Victor Stinner in 
branch 'master':
bpo-36635, bpo-36696: Fix setup.py on AIX (GH-12922)
https://github.com/python/cpython/commit/574913479f26b5ff48827861bce68281be01d16e


--

___
Python tracker 

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



[issue31525] require sqlite3_prepare_v2

2019-04-23 Thread Charles P


Change by Charles P :


--
pull_requests: +12852

___
Python tracker 

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



[issue36697] inspect.getclosurevars returns wrong globals dict

2019-04-23 Thread Eric V. Smith


Eric V. Smith  added the comment:

That is interesting. See these examples. I'm starting a new interpreter each 
time:

>>> import inspect
>>> def abc(): pass
...
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={}, builtins={}, unbound=set())
>>>


>>> import inspect
>>> def abc(): a
...
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={}, builtins={}, unbound={'a'})
>>>

>>> import inspect
>>> a=0
>>> def abc(): a
...
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={'a': 0}, builtins={}, unbound=set())
>>>

>>> import inspect
>>> a=0
>>> def abc(): a.b
...
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={'a': 0}, builtins={}, unbound={'b'})
>>>

>>> import inspect
>>> a=0
>>> b=1
>>> def abc(): a.b
...
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={'a': 0, 'b': 1}, builtins={}, unbound=set())
>>> 

It's odd.

--

___
Python tracker 

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



[issue36659] distutils UnixCCompiler: Remove standard library path from rpath

2019-04-23 Thread STINNER Victor

STINNER Victor  added the comment:

> ... Now, I'm confused. Is PR 12876 useless? Was distutils already fixed?

My test was wrong, objdump sometimes uses "RUNPATH", sometimes "RPATH":

$ objdump -a -x 
build/lib.linux-x86_64-*/lxml/etree.cpython-*-x86_64-linux-gnu.so|grep -i -E 
'rpath|RUNPATH'
  RUNPATH  /opt/py38/lib

Wait, they are not the same. Now I'm confused :-)

More doc about RPATH and RUNPATH:

https://blog.qt.io/blog/2011/10/28/rpath-and-runpath/

"An additional source of confusion is that, depending on your distribution, the 
-rpath argument in ‘ld’ behaves differently. For some it generates a DT_RPATH 
and for others DT_RPATH and DT_RUNPATH."

"""
Unless loading object has RUNPATH:
RPATH of the loading object,
then the RPATH of its loader (unless it has a RUNPATH), ...,
until the end of the chain, which is either the executable
or an object loaded by dlopen
Unless executable has RUNPATH:
RPATH of the executable
LD_LIBRARY_PATH
RUNPATH of the loading object
ld.so.cache
default dirs
"""


I'm now also confused by 

UnixCCompiler.runtime_library_dir_option() of distutils.unixccompiler which 
starts with a long comment:

# XXX Hackish, at the very least.  See Python bug #445902:
# http://sourceforge.net/tracker/index.php
#   ?func=detail=445902_id=5470=105470
# Linkers on different platforms need different options to
# specify that directories need to be added to the list of
# directories searched for dependencies when a dynamic library
# is sought.  GCC on GNU systems (Linux, FreeBSD, ...) has to
# be told to pass the -R option through to the linker, whereas
# other compilers and gcc on other systems just know this.
# Other compilers may need something slightly different.  At
# this time, there's no way to determine this information from
# the configuration data stored in the Python installation, so
# we use this hack.

Linux code path:

if self._is_gcc(compiler):
# gcc on non-GNU systems does not need -Wl, but can
# use it anyway.  Since distutils has always passed in
# -Wl whenever gcc was used in the past it is probably
# safest to keep doing so.
if sysconfig.get_config_var("GNULD") == "yes":
# GNU ld needs an extra option to get a RUNPATH
# instead of just an RPATH.
return "-Wl,--enable-new-dtags,-R" + dir
else:
return "-Wl,-R" + dir
else:
# No idea how --enable-new-dtags would be passed on to
# ld if this system was using GNU ld.  Don't know if a
# system like this even exists.
return "-R" + dir

When GCC is detected on Linux and GNULD sysconfig variable is equal to "yes", 
distutils uses "-Wl,--enable-new-dtags,-R " rather than "-Wl,-R " 
or just "-R ".


See also https://wiki.debian.org/RpathIssue

--

___
Python tracker 

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



[issue36697] inspect.getclosurevars returns wrong globals dict

2019-04-23 Thread Noitul


Noitul  added the comment:

Sorry for the misleading snippet above.

And how about this one:

>>> import inspect  
>>> a = 0   
>>> b = 1
>>> c = 2   
>>> def abc():  
>>> return a.b  
>>> print(inspect.getclosurevars(abc))  

ClosureVars(nonlocals={}, globals={'a': 0, 'b': 1}, builtins={}, unbound=set())

If this is not a bug, the "globals" is the "function's module globals", but why 
'c' not in the "globals"?

--
status: pending -> open

___
Python tracker 

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



[issue36697] inspect.getclosurevars returns wrong globals dict

2019-04-23 Thread Eric V. Smith

Eric V. Smith  added the comment:

I think this is correct. The documentation says globals is "the function’s 
module globals". I suggest closing this as not a bug.

https://docs.python.org/3/library/inspect.html#inspect.getclosurevars

--
nosy: +eric.smith
status: open -> pending
type:  -> behavior

___
Python tracker 

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



[issue36696] possible multiple regressions on AIX

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

> Should I open PR - or is this better fixed in the original PR? What keeps 
> things cleaner?

I wrote PR 12922.

I really hate -Ddefine syntax, but it seems like we have to use it just for AIX 
:-( I tried to use "-D Py_BUILD_CORE_..." in Modules/Setup, but 
Module/makesetup is also stupid and doesn't support this syntax :-( I was too 
lazy to fix Module/makesetup.

--
nosy: +vstinner

___
Python tracker 

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



[issue36696] possible multiple regressions on AIX

2019-04-23 Thread Michael Felt

Michael Felt  added the comment:

On 22/04/2019 14:15, Inada Naoki wrote:
> Inada Naoki  added the comment:
>
> Maybe, XLC doesn't support -D name.  -Dname should be used instead.

Excellent hint: the diff between bot run 1013 and run 1014 reveals:

diff --git a/setup.py b/setup.py
index 9c83914fd9..c470719a6a 100644
--- a/setup.py
+++ b/setup.py
@@ -725,13 +725,13 @@ class PyBuildExt(build_ext):
 # heapq
 self.add(Extension("_heapq", ["_heapqmodule.c"]))
 # C-optimized pickle replacement
-    self.add(Extension("_pickle", ["_pickle.c"]))
+    self.add(Extension("_pickle", ["_pickle.c"],
+   extra_compile_args=['-D Py_BUILD_CORE_MODULE']))
 # atexit
 self.add(Extension("atexit", ["atexitmodule.c"]))
 # _json speedups
 self.add(Extension("_json", ["_json.c"],
-   # pycore_accu.h requires Py_BUILD_CORE_BUILTIN
-   extra_compile_args=['-DPy_BUILD_CORE_BUILTIN']))
+   extra_compile_args=['-D Py_BUILD_CORE_MODULE']))

 # profiler (_lsprof is for cProfile.py)
 self.add(Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']))

So, some simple editing: and the diff with master (of yesterday):

diff --git a/setup.py b/setup.py
index 3d6404f89e..58c16e8ba4 100644
--- a/setup.py
+++ b/setup.py
@@ -726,12 +726,12 @@ class PyBuildExt(build_ext):
 self.add(Extension("_heapq", ["_heapqmodule.c"]))
 # C-optimized pickle replacement
 self.add(Extension("_pickle", ["_pickle.c"],
-   extra_compile_args=['-D Py_BUILD_CORE_MODULE']))
+   extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
 # atexit
 self.add(Extension("atexit", ["atexitmodule.c"]))
 # _json speedups
 self.add(Extension("_json", ["_json.c"],
-   extra_compile_args=['-D Py_BUILD_CORE_MODULE']))
+   extra_compile_args=['-DPy_BUILD_CORE_MODULE']))

 # profiler (_lsprof is for cProfile.py)
 self.add(Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']))
@@ -816,7 +816,7 @@ class PyBuildExt(build_ext):

 # Python Internal C API test module
 self.add(Extension('_testinternalcapi', ['_testinternalcapi.c'],
-   extra_compile_args=['-D Py_BUILD_CORE_MODULE']))
+   extra_compile_args=['-DPy_BUILD_CORE_MODULE']))

 # Python PEP-3118 (buffer protocol) test module
 self.add(Extension('_testbuffer', ['_testbuffer.c']))

And now the modules build as expected.

Should I open PR - or is this better fixed in the original PR? What
keeps things cleaner?

>
> --
> nosy: +inada.naoki
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Martin Panter

Martin Panter  added the comment:

The “urllib” package also contains “urllib.parse”, which is a lot more 
lightweight than “urllib.request”. In a quick experiment, importing 
“urllib.request” is more than 2 times slower than importing “urllib.parse” on 
its own. And importing “urllib” by itself is not much faster, so I guess a lot 
of the time is unavoidable Python startup, and “urllib.request” is probably 
many times slower than “urllib.parse”.

The reason for the slowness is the dependencies and initialization. The 
“urllib.parse” module only imports a few commonly-used modules. On the other 
hand, importing “urllib.request” imports many heavyweight high-level modules 
directly and indirectly (email submodules in particular, also things like SSL, 
multithreading, HTTP client, temporary files). Some of these dependencies also 
compile lots of regular expressions at import time.

The slowdown can be a problem for things like command-line programs. Just today 
I found “circusd --help” on a Raspberry Pi took ~5 s to produce output.

The case of “os.path” is different: it isn’t a submodule of “os”. It is just a 
pointer to “posixpath”, “ntpath”, etc, depending on “os.name”.

--
nosy: +martin.panter

___
Python tracker 

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



[issue36018] Add a Normal Distribution class to the statistics module

2019-04-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset fb8c7d53326d137785ca311bfc48c8284da46770 by Raymond Hettinger in 
branch 'master':
bpo-36018: Make "seed" into a keyword only argument (GH-12921)
https://github.com/python/cpython/commit/fb8c7d53326d137785ca311bfc48c8284da46770


--

___
Python tracker 

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



[issue36696] possible multiple regressions on AIX

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +12851
stage:  -> patch review

___
Python tracker 

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



[issue36635] Add _testinternalcapi module

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12850

___
Python tracker 

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



[issue35904] Add statistics.fmean(seq)

2019-04-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 7280048690244e73b13f4f68b96c244bcb5434e8 by Raymond Hettinger in 
branch 'master':
bpo-35904: Add missing fmean() entry to the summary table (GH-12919)
https://github.com/python/cpython/commit/7280048690244e73b13f4f68b96c244bcb5434e8


--

___
Python tracker 

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



[issue30465] FormattedValue expressions have wrong lineno and col_offset information

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8a9a6b443c57e47e9d10ed7775479aada4dac719 by Victor Stinner in 
branch '3.7':
[3.7] bpo-9566: Fix compiler warnings on Windows (GH-12920)
https://github.com/python/cpython/commit/8a9a6b443c57e47e9d10ed7775479aada4dac719


--
nosy: +vstinner

___
Python tracker 

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



[issue27645] Supporting native backup facility of SQLite

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8a9a6b443c57e47e9d10ed7775479aada4dac719 by Victor Stinner in 
branch '3.7':
[3.7] bpo-9566: Fix compiler warnings on Windows (GH-12920)
https://github.com/python/cpython/commit/8a9a6b443c57e47e9d10ed7775479aada4dac719


--

___
Python tracker 

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



[issue36018] Add a Normal Distribution class to the statistics module

2019-04-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +12849

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8a9a6b443c57e47e9d10ed7775479aada4dac719 by Victor Stinner in 
branch '3.7':
[3.7] bpo-9566: Fix compiler warnings on Windows (GH-12920)
https://github.com/python/cpython/commit/8a9a6b443c57e47e9d10ed7775479aada4dac719


--

___
Python tracker 

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



[issue30465] FormattedValue expressions have wrong lineno and col_offset information

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12847

___
Python tracker 

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



[issue36703] [Easy][Windows] test_subprocess: test_close_fds_with_stdio() has a race condition

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +pablogsal

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12846

___
Python tracker 

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



[issue27645] Supporting native backup facility of SQLite

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12848

___
Python tracker 

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



[issue35904] Add statistics.fmean(seq)

2019-04-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +12845

___
Python tracker 

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



[issue36703] [Easy][Windows] test_subprocess: test_close_fds_with_stdio() has a race condition

2019-04-23 Thread STINNER Victor


New submission from STINNER Victor :

test_subprocess: test_close_fds_with_stdio() pass when run alone, but fail when 
run in parallel.

I tagged the issue as "easy" for new contributors to Python. If someone is 
interested to work on this issue, please contact me in private.


https://buildbot.python.org/all/#/builders/3/builds/2446

I can reproduce the issue.

The test pass when run alone:

> python -m test test_subprocess -m test_close_fds_with_stdio  -v
Running Debug|x64 interpreter...
== CPython 3.7.3+ (heads/3.7:9344d74f7b, Apr 23 2019, 09:53:41) [MSC v.1915 64 
bit (AMD64)]
== Windows-10-10.0.17763-SP0 little-endian
== cwd: C:\vstinner\python\3.7\build\test_python_6116
== CPU count: 2
== encodings: locale=cp1252, FS=utf-8
Run tests sequentially
0:00:00 [1/1] test_subprocess
test_close_fds_with_stdio (test.test_subprocess.Win32ProcessTestCase) ... ok

--

Ran 1 test in 0.302s

OK

== Tests result: SUCCESS ==

1 test OK.

Total duration: 391 ms
Tests result: SUCCESS


But the test fails when run in parallel:

> python -m test test_subprocess -m test_close_fds_with_stdio -F -j4
Running Debug|x64 interpreter...
Run tests in parallel using 4 child processes
0:00:01 [  1/1] test_subprocess failed
test test_subprocess failed -- Traceback (most recent call last):
  File "C:\vstinner\python\3.7\lib\test\test_subprocess.py", line 2930, in 
test_close_fds_with_stdio
self.assertEqual(p.returncode, 1)
AssertionError: 0 != 1
0:00:01 [  2/1] test_subprocess passed
0:00:01 [  3/2] test_subprocess failed
test test_subprocess failed -- Traceback (most recent call last):
  File "C:\vstinner\python\3.7\lib\test\test_subprocess.py", line 2930, in 
test_close_fds_with_stdio
self.assertEqual(p.returncode, 1)
AssertionError: 0 != 1
0:00:01 [  4/3] test_subprocess failed
test test_subprocess failed -- Traceback (most recent call last):
  File "C:\vstinner\python\3.7\lib\test\test_subprocess.py", line 2942, in 
test_close_fds_with_stdio
self.assertEqual(p.returncode, 1)
AssertionError: 0 != 1
0:00:02 [  5/3] test_subprocess passed
0:00:02 [  6/3] test_subprocess passed

== Tests result: FAILURE ==

3 tests OK.

3 tests failed:
test_subprocess test_subprocess test_subprocess

Total duration: 2 sec 313 ms
Tests result: FAILURE

--
keywords: easy
messages: 340698
nosy: vstinner
priority: normal
severity: normal
status: open
title: [Easy][Windows] test_subprocess: test_close_fds_with_stdio() has a race 
condition

___
Python tracker 

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



[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Berker Peksag


Berker Peksag  added the comment:

What about other packages in the stdlib? For example, you can see the same 
behavior in the email package:

>>> import email
>>> email.message.EmailMessage()
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: module 'email' has no attribute 'message'

IMO, this is how imports work in Python and IIRC os.path is the only exception 
in the stdlib. I think this needs to be discussed on python-ideas first.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue13968] Support recursive globs

2019-04-23 Thread Marc


Marc  added the comment:

Please review one word documentation change at 
https://github.com/python/cpython/pull/12918 to clarify that recursive glob ** 
follows symbolic links to directories.

--
nosy: +marc-hb
pull_requests: +12844

___
Python tracker 

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



[issue34155] email.utils.parseaddr mistakenly parse an email

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue36546] Add quantiles() to the statistics module

2019-04-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

As requested, I've made the API easily extendable to handle alternative methods 
if those are deemed necessary.  Also, it is easy to change the default.

That said, it is my hope that these two methods and the current default get 
kept.  They have several virtues:  easy to explain, obviousness, widely adopted 
(most of the  other packages offer at least of these two methods), and they 
have most of the desired properties listed in Hyndman & Fan.  They are a good 
practical choice.

--
resolution:  -> fixed
stage: patch review -> 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



[issue34155] email.utils.parseaddr mistakenly parse an email

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue18564] Integer overflow in the socket function parsing a Bluetooth address

2019-04-23 Thread STINNER Victor


STINNER Victor  added the comment:

Hum, maybe I'm just confused by "integer overflow". To me, "integer overflow" 
means that an operation goes out of the bounds of a C integer type. But here, 
the problem is more than the parser accepts invalid Bluetooth addresses?

Please use a better title than "Fix integer overflow in socketmodule". Maybe 
"Fix Bluetooth address parser"?

--

___
Python tracker 

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



[issue36546] Add quantiles() to the statistics module

2019-04-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 9013ccf6d8037f6ae78145a42d194141cb10d332 by Raymond Hettinger in 
branch 'master':
bpo-36546: Add statistics.quantiles() (#12710)
https://github.com/python/cpython/commit/9013ccf6d8037f6ae78145a42d194141cb10d332


--

___
Python tracker 

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



[issue36695] Change (regression?) in v3.8.0a3 doctest output after capturing the stderr output from a raised warning

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue36702] test_dtrace failed

2019-04-23 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue36702] test_dtrace failed

2019-04-23 Thread sayno996


New submission from sayno996 :

I install Python 3.7.3 on CentOS 7.6. However, when I run "make test", I got a 
failure on test_dtrace as:

Ran 8 tests in 4.752s

FAILED (failures=6, skipped=2)
test test_dtrace failed
test_dtrace failed

== Tests result: FAILURE ==

1 test failed:
test_dtrace

Total duration: 4 sec 771 ms
Tests result: FAILURE

--
components: Build
files: test.log
messages: 340692
nosy: sayno996
priority: normal
severity: normal
status: open
title: test_dtrace failed
type: compile error
versions: Python 3.7
Added file: https://bugs.python.org/file48284/test.log

___
Python tracker 

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



[issue35824] http.cookies._CookiePattern modifying regular expressions

2019-04-23 Thread SilentGhost


Change by SilentGhost :


--
nosy: +martin.panter, xtreak

___
Python tracker 

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



[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

I vaguely recollect the reason for this. It was done with the translation of 
Python2 code (which had urllib, urllib2, and urlparse, robotparser) etc, 
combined into a single package. We wanted to keep the import as urllib.request 
and urllib.response, and urllib.parse

That said. If there is no other request currently open for this. Let's keep 
this, and am +1 to this suggestion. We have to think if there are any potential 
drawbacks for the old code which is already using 2nd level import.

--
nosy: +orsenthil

___
Python tracker 

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



[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Piyush


New submission from Piyush :

The current way to use one of `urllib.request` APIs is like this:
```
import urllib.request
urllib.request.urlretrieve
```

Can we change this to:
```
import urllib
urllib.request.urlretrieve
```
This will require adding 1 line at 
https://github.com/python/cpython/blob/master/Lib/urllib/__init__.py

This is required because help on `urllib` says that `request` is part of 
`urllib` suggesting that `urllib.request` should be available if I `import 
urllib`.
Moreover `import urllib.request` is not at all intuitive.

I can submit a PR if other's think what I'm proposing makes sense.

--
files: Screen Shot 2019-04-23 at 11.22.48 AM.png
messages: 340690
nosy: piyush-kgp
priority: normal
severity: normal
status: open
title: module 'urllib' has no attribute 'request'
versions: Python 3.6
Added file: https://bugs.python.org/file48283/Screen Shot 2019-04-23 at 
11.22.48 AM.png

___
Python tracker 

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