[issue36445] bus error in test_gil test on armhf running with 64bit kernel

2019-04-03 Thread Matthias Klose


Change by Matthias Klose :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> unaligned memory access in the _sha3 extension

___
Python tracker 

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



[issue36505] PYTHON-CAN with vector

2019-04-03 Thread SilentGhost


SilentGhost  added the comment:

Again, this is not the problem with Python as a language, its implementation in 
CPython or the standard library. Please, don't re-open this issue again.

--
status: open -> closed

___
Python tracker 

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



[issue36514] -m switch revisited

2019-04-03 Thread SilentGhost


SilentGhost  added the comment:

Colin, sorry, are you reporting an issue? Because I have trouble understanding 
what is. The examples you've posted seem to work as expected, no?

--
nosy: +SilentGhost

___
Python tracker 

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



[issue36489] add filename_extension_map and/or content-types_map dict(s) to mimetypes

2019-04-03 Thread SilentGhost


Change by SilentGhost :


--
components: +Library (Lib)
nosy: +r.david.murray
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



[issue36481] telnetlib process_rawq() callback

2019-04-03 Thread SilentGhost


SilentGhost  added the comment:

As a general rule, your PR would have to include documentation (including a 
NEWS entry) and tests for the new functionality. Naturally, by itself it's not 
a guarantee that this suggestion would be accepted.

--
nosy: +SilentGhost, giampaolo.rodola
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-04-03 Thread SilentGhost


Change by SilentGhost :


--
nosy: +ncoghlan
versions:  -Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue34430] Symmetrical chaining futures in asyncio.future.wrap_future

2019-04-03 Thread Alfred Sawaya


Alfred Sawaya  added the comment:

Can be closed if not needed by the community.

--
resolution:  -> wont fix
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



[issue36516] Python Launcher can not recognize pyw file as Python GUI Script file type correctly.

2019-04-03 Thread Jiongjiong Gao


Change by Jiongjiong Gao :


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

___
Python tracker 

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



[issue36506] [security] CVE-2019-10268: An arbitrary execution vulnerability exists in the built-in function getattr

2019-04-03 Thread Christian Heimes


Christian Heimes  added the comment:

Could you please do us a favor and contact MITRE to get the CVE number revoked? 
Please CC secur...@python.org so we have a record of the emails.

--

___
Python tracker 

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



[issue36514] -m switch revisited

2019-04-03 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

This is not a bug:

* "python -m NAME" runs module (or package) NAME as a script, NAME should 
therefore be a module name and not a filename (and hence not have a .py suffix)

* "python NAME" runs a script in file NAME and should therefore by a complete 
file name, including a suffix when the file name has a suffix.

In your examples "python -m vixsd.py" and "python vixsd" correctly raise an 
error.

--
nosy: +ronaldoussoren
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



[issue36514] -m switch revisited

2019-04-03 Thread Colin Dick


Colin Dick  added the comment:

No, the first example is expected,
BUT the middle two work
HENCE the last should NOT have a problem either...
No?
Because the middle two work,
so should the last complete without any errors.
There were no code changes,
Therefore the problem is with python

On Wed, 3 Apr 2019, 23:42 Ronald Oussoren  wrote:

>
> Ronald Oussoren  added the comment:
>
> This is not a bug:
>
> * "python -m NAME" runs module (or package) NAME as a script, NAME should
> therefore be a module name and not a filename (and hence not have a .py
> suffix)
>
> * "python NAME" runs a script in file NAME and should therefore by a
> complete file name, including a suffix when the file name has a suffix.
>
> In your examples "python -m vixsd.py" and "python vixsd" correctly raise
> an error.
>
> --
> nosy: +ronaldoussoren
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue9883] minidom: AttributeError: DocumentFragment instance has no attribute 'writexml'

2019-04-03 Thread James Socol


Change by James Socol :


--
nosy:  -jamessocol

___
Python tracker 

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



[issue36489] add filename_extension_map and/or content-types_map dict(s) to mimetypes

2019-04-03 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> However this seems to compete with the functionality of the types map so 
> another consideration is content-types_map where the content-type is the key 
> and the pair values are lists of valid filename extensions:

There is mimetypes.MimeTypes().types_map_inv

> https://docs.python.org/3.8/library/mimetypes.html#mimetypes.MimeTypes.types_map_inv
> Tuple containing two dictionaries, mapping MIME types to a list of filename 
> extensions: the first dictionary is for the non-standards types and the 
> second one is for the standard types. They are initialized by common_types 
> and types_map.

>>> mimetypes.MimeTypes().types_map_inv[1]['text/html']
['.htm', '.html']

--
nosy: +xtreak

___
Python tracker 

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



[issue36514] -m switch revisited

2019-04-03 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Given a python script in a file named foo.py in the current directory:

* python -m foo  

  Should, and does, work.

* python -m foo.py

  Raises an error, because the command tries to run the submodule "py" of
  module "foo" as the __main__ module. For script files this will raise an
  error because module "foo" is not a package (hence the AttributeError about
  __path__).

  The error might get raised at the end of the script because the interpreter
  executes the module body on import before it looks for attributes and
  submodules.

* python foo

  Does not work because there is no file named "foo". This is expected 
  behaviour. 

* python foo.py

  Works because there is a file named foo.py. The interpreter executes the
  contents of the file.


"python NAME" and "python -m NAME" are not the same, which is why the two 
invocations behave differently. This is expected behaviour and not a bug.

See also "https://docs.python.org/3/using/cmdline.html#cmdoption-m";

--

___
Python tracker 

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



[issue36517] typing.NamedTuple does not support mixins

2019-04-03 Thread Andrew Wason


New submission from Andrew Wason :

Subclassing typing.NamedTuple an inheriting from a mixin class does not work. 
It does work for collections.namedtuple, and can be worked around by modifying 
typing.NamedTupleMeta:

>>> import collections
>>> import typing
>>>
>>>
>>> class Mixin:
... def mixin(self):
... return "mixin"
...
>>>
>>> class CollectionsNamedTuple(Mixin, 
>>> collections.namedtuple('CollectionsNamedTuple', [
... "a",
... "b",
... ])):
... pass
...
>>>
>>> class TypingNamedTuple(Mixin, typing.NamedTuple):
... a: str
... b: str
...
>>>
>>> class NamedTupleMeta(typing.NamedTupleMeta):
... def __new__(cls, typename, bases, ns):
... cls_obj = super().__new__(cls, typename + '_nm_base', bases, ns)
... bases = bases + (cls_obj,)
... return type(typename, bases, {})
...
>>>
>>> class FixedTypingNamedTuple(Mixin, metaclass=NamedTupleMeta):
... a: str
... b: str
...
>>>
>>> cnt = CollectionsNamedTuple("av", "bv")
>>> tnt = TypingNamedTuple("av", "bv")
>>> ftnt = FixedTypingNamedTuple("av", "bv")
>>>
>>> cnt.mixin()
'mixin'
>>> ftnt.mixin()
'mixin'
>>> tnt.mixin()
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'TypingNamedTuple' object has no attribute 'mixin'

--
components: Library (Lib)
messages: 339390
nosy: rectalogic
priority: normal
severity: normal
status: open
title: typing.NamedTuple does not support mixins
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



[issue36517] typing.NamedTuple does not support mixins

2019-04-03 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue36216] CVE-2019-9636: urlsplit does not handle NFKC normalization

2019-04-03 Thread Matej Cepl


Matej Cepl  added the comment:

I am trying to investigate the impact of this bug on Python 2.6 (yes, it is for 
SLE), and I have hard to replicate the steps in the description even on 2.7:

~$ ipython2
Python 2.7.15 (default, May 21 2018, 17:53:03) [GCC]
Type "copyright", "credits" or "license" for more information.

IPython 5.8.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from urlparse import urlsplit

In [2]: u = "https://example.com\uf...@bing.com".encode("idna").decode("ascii") 

In [3]: u
Out[3]: u'https://example.com\\uf...@bing.com'

In [4]: urlsplit(u).netloc.rpartition('@')[2]
Out[4]: u'bing.com'

In [5]: u = "https://example.com\uf...@bing.com";

In [6]: urlsplit(u).netloc.rpartition('@')[2]
Out[6]: 'bing.com'

In [7]: u = u.encode("idna").decode("ascii") 

In [8]: urlsplit(u).netloc.rpartition('@')[2]
Out[8]: u'bing.com'

In [9]: import unicodedata

In [10]: u2 = unicodedata.normalize('NFKC', u)

In [11]: u2
Out[11]: u'https://example.com\\uf...@bing.com'

In [12]: urlsplit(u2)
Out[12]: SplitResult(scheme=u'https', netloc=u'example.com\\uf...@bing.com', 
path=u'', query='', fragment='')

In [13]:

Yes, the results are weird, and most likely they would break any software 
relying on them, but I am not sure that it is a security issue.

vstinner ? steve.dower ? What do you think?

--
nosy: +mcepl

___
Python tracker 

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



[issue36517] typing.NamedTuple does not support mixins

2019-04-03 Thread Stéphane Wirtel

Change by Stéphane Wirtel :


--
nosy: +rhettinger

___
Python tracker 

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



[issue36518] Avoid conflicts when pass arbitrary keyword arguments to Python function

2019-04-03 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

This is yet one alternative to PEP 570. It does not solve all problems that PEP 
570 is purposed to solve, but it significantly reduces the need in 
positional-only parameters.

Currently the problem with implementing in Python functions that should accept 
arbitrary keyword arguments is that argument names can conflict with names of 
other parameters (in particularly "self"). For example, look at the function

def log(fmt, **kwargs):
print(fmt.format_map(kwargs))

You cannot call log('Format: {fmt}', fmt='binary'), because the argument for 
parameter "fmt" is specified twice: as positional argument and as keyword 
argument.

The idea is that if the function has the var-keyword parameter, then keyword 
arguments with names which match passed positional arguments will be saved into 
the var-keyword dict instead of be error.

The advantage of this idea over alternatives is that it does not need changing 
the user code. Implementing this feature will fix the user code that we do not 
even see. Most functions that otherwise would need positional only parameters 
(over 60 in the stdlib) will be automatically fixed by this feature. We could 
revert the deprecations added in issue36492 and simplify few functions that 
used the *args hack before.

The change itself is very simple, just modification of few lines in ceval.c and 
inspect.py.

The disadvantage is that it does not help with optional parameters. For example:

def make_dict(dict=(), **kwargs):
res = {}
res.update(dict)
res.update(kwargs)
return res

make_dict(dict={}, list=[]) will still return {'list': []} instead of {'dict': 
{}, list: []}. You still need to use the *args hack to get the latter result. 
But there are not much such functions.

This idea was proposed by Steve [1].

[1] 
https://discuss.python.org/t/pep-570-python-positional-only-parameters/1078/39

--
components: Interpreter Core
messages: 339392
nosy: gvanrossum, serhiy.storchaka, steve.dower
priority: normal
severity: normal
status: open
title: Avoid conflicts when pass arbitrary keyword arguments to Python function
type: enhancement
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



[issue36518] Avoid conflicts when pass arbitrary keyword arguments to Python function

2019-04-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue36517] typing.NamedTuple does not support mixins

2019-04-03 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue6721] Locks in the standard library should be sanitized on fork

2019-04-03 Thread cagney


cagney  added the comment:

> Does your code use any C code that forks on its own without properly calling 
> the C Python PyOS_BeforeFork(), PyOS_AfterFork_Parent(), and 
> PyOS_AfterFork_Child() APIs?

No.

Is there a web page explaining how to pull a python backtrace from all the 
threads running within a daemon?

--

___
Python tracker 

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



[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2019-04-03 Thread Petr Viktorin


Change by Petr Viktorin :


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



[issue36519] Blake2b/s implementations have minor GIL issues

2019-04-03 Thread George King


New submission from George King :

I was browsing the Blake2b module implementation in master and noticed two 
subtle issues in blake2b_impl.c. There are two places where the GIL gets 
released; both of them appear flawed.

py_blake2b_new_impl, line 221. The ALLOW_THREADS block fails to acquire/release 
self->lock.

_blake2_blake2b_update, line 279. The lock is lazily allocated correctly on 
line 279. However the test on 282 that chooses to release the GIL or not fails 
to take into account the length test. This means that once a large block is fed 
to `update`, then every call to update will release the GIL, even if it is a 
single byte.

It should look something more like this:
```
bool should_allow_threads = (buf.len >= HASHLIB_GIL_MINSIZE);
if (should_allow_threads && self->lock == NULL)
  self->lock = PyThread_allocate_lock();
if (should_allow_threads && self->lock != NULL) { ... }
else { ... }
```

This respects the size criterion, and also protects against the case where the 
lock allocation fails.

--
components: Extension Modules
messages: 339394
nosy: gwk
priority: normal
severity: normal
status: open
title: Blake2b/s implementations have minor GIL issues
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



[issue36519] Blake2b/s implementations have minor GIL issues

2019-04-03 Thread SilentGhost


Change by SilentGhost :


--
nosy: +christian.heimes
type:  -> behavior

___
Python tracker 

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



[issue36518] Avoid conflicts when pass arbitrary keyword arguments to Python function

2019-04-03 Thread Mario Corchero


Change by Mario Corchero :


--
nosy: +mariocj89

___
Python tracker 

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



[issue36506] [security] CVE-2019-10268: An arbitrary execution vulnerability exists in the built-in function getattr

2019-04-03 Thread bigbigliang


bigbigliang  added the comment:

>
> Certainly.
>
>

--

___
Python tracker 

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



[issue36519] Blake2b/s implementations have minor GIL issues

2019-04-03 Thread Christian Heimes


Christian Heimes  added the comment:

Thanks, I'll have a look.

--
assignee:  -> christian.heimes
versions: +Python 3.6, Python 3.8

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2019-04-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

See also PEP 590, which has very similar ideas. Also PEP 580 is related to this.

--

___
Python tracker 

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



[issue13947] gdbm reorganize() leaves hanging file descriptor

2019-04-03 Thread sds


sds  added the comment:

I observe the same behavior on Linux 4.18.0-17-generic #18-Ubuntu
with Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0].
gdbm 1.14.1-6:
after

db = dbm.gnu.open("asdf","n")
db["a"] = "124"
db.reorganize()
db.close()

I see

$ lsof ~/asdf 
COMMAND   PID USER  FD   TYPE DEVICE SIZE/OFFNODE NAME
python3 22071  sds mem-W  REG8,216384 4328326 /home/sds/asdf

and

>>> db = dbm.gnu.open("asdf","r")
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/sds/src/pyapp/tests/fileconv_test.py", line 1053, in 
_gdbm.error: [Errno 11] Resource temporarily unavailable

--
nosy: +sam-s

___
Python tracker 

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



[issue21879] str.format() gives poor diagnostic on placeholder mismatch

2019-04-03 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

@franciscouzo any status on this? Do you need any help on this?

--

___
Python tracker 

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



[issue13947] gdbm reorganize() leaves hanging file descriptor

2019-04-03 Thread sds


Change by sds :


--
type:  -> behavior

___
Python tracker 

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



[issue13947] gdbm reorganize() leaves hanging file descriptor

2019-04-03 Thread sds


Change by sds :


--
components: +Library (Lib)
versions: +Python 3.7 -Python 2.7, Python 3.2

___
Python tracker 

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



[issue13947] gdbm reorganize() leaves hanging file descriptor

2019-04-03 Thread sds


Change by sds :


--
versions: +Python 3.6 -Python 3.7

___
Python tracker 

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



[issue21879] str.format() gives poor diagnostic on placeholder mismatch

2019-04-03 Thread Francisco Couzo


Change by Francisco Couzo :


--
pull_requests: +12602
stage: needs patch -> patch review

___
Python tracker 

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



[issue21879] str.format() gives poor diagnostic on placeholder mismatch

2019-04-03 Thread Francisco Couzo


Francisco Couzo  added the comment:

I just made the pull request, I totally forgot I mentioned I was going to work 
on this, sorry!

--

___
Python tracker 

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



[issue36054] Way to detect CPU count inside docker container

2019-04-03 Thread Manjusaka

Manjusaka  added the comment:

Hi Stéphane:

I have checked the JVM implantation about container improvements. I confirm 
that maybe we need a new Libary for container environment. I don't think that 
combine it into the os module is a good idea. I will make a PR during this week.

--

___
Python tracker 

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



[issue12756] datetime.datetime.utcnow should return a UTC timestamp

2019-04-03 Thread Agustin


Agustin  added the comment:

Hi there, I was wondering if we re-open this issue breaking the backward 
compatibility now?

--
nosy: +tin
versions: +Python 3.9 -Python 2.7, Python 3.2

___
Python tracker 

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



[issue35625] Comprehension doc doesn't mention buggy class scope behavior

2019-04-03 Thread Aaron Hall


Change by Aaron Hall :


--
nosy: +Aaron Hall

___
Python tracker 

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



[issue36054] Way to detect CPU count inside docker container

2019-04-03 Thread Christian Heimes


Christian Heimes  added the comment:

The JVM parses cgroups information from the proc filesystem and evaluates CPU 
count from the cgroup cpu.shares and cpu.cfs.

https://github.com/openjdk/jdk/blob/d5686b87f31d6c57ec6b3e5e9c85a04209dbac7a/src/hotspot/os/linux/os_linux.cpp#L5304-L5336

https://github.com/openjdk/jdk/blob/2d5137e403e16b694800b2ffe18c3640396b757e/src/hotspot/os/linux/osContainer_linux.cpp#L517-L591

--
nosy: +christian.heimes

___
Python tracker 

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



[issue36466] Adding a way to strip annotations from compiled bytecode

2019-04-03 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

+1 from me.

There are two ways to enable this:
* Add -OOO that would remove all three: asserts, docstrings, annotations
* Add separate --O-asserts --O-docstrings --O-annotations (or similar)

I think I like the second option more.

@cary Please note that our workflow changed, you can now submit a PR to our 
GitHub repo instead of sending a patch.

Also please include tests and docs in your PR.

--

___
Python tracker 

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



[issue36518] Avoid conflicts when pass arbitrary keyword arguments to Python function

2019-04-03 Thread László Kiss Kollár

Change by László Kiss Kollár :


--
nosy: +lkollar

___
Python tracker 

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



[issue36504] Signed integer overflow in _ctypes.c's PyCArrayType_new()

2019-04-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12603

___
Python tracker 

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



[issue9883] minidom: AttributeError: DocumentFragment instance has no attribute 'writexml'

2019-04-03 Thread Stefan Behnel


Stefan Behnel  added the comment:

Seems like a reasonable request to me, even if it hasn't been touched or 
re-requested for years.

Funny enough, DocumentFragment is currently documented as "not implemented" (as 
for Entity, Notation, CDATASection, CharacterData, DOMImplementation, 
DocumentType). I'll add a PR to clean those up.

https://docs.python.org/3/library/xml.dom.minidom.html#minidom-and-the-dom-standard

--

___
Python tracker 

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



[issue9883] minidom: AttributeError: DocumentFragment instance has no attribute 'writexml'

2019-04-03 Thread Stefan Behnel


Change by Stefan Behnel :


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

___
Python tracker 

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



[issue36260] Cpython/Lib vulnerability found and request a patch submission

2019-04-03 Thread Victor Kung

Victor Kung  added the comment:

Hello Python community,

I’m curious why the patch or pitfall prevention in ZipFile
 are not suggested. I have no idea if everyone read documentation in detail. It 
seems straightforward to add the methods in ZipFile with well documented rather 
than just warn in documentation. Any comment would be appreciated.

Victor Kung

--
nosy: +Victor Kung

___
Python tracker 

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



[issue36504] Signed integer overflow in _ctypes.c's PyCArrayType_new()

2019-04-03 Thread miss-islington


miss-islington  added the comment:


New changeset 9c08eeb30ca0e551323467b62ae40e08e30839b3 by Miss Islington (bot) 
in branch '3.7':
bpo-36504: Fix signed integer overflow in _ctypes.c's PyCArrayType_new(). 
(GH-12660)
https://github.com/python/cpython/commit/9c08eeb30ca0e551323467b62ae40e08e30839b3


--
nosy: +miss-islington

___
Python tracker 

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



[issue36260] Cpython/Lib vulnerability found and request a patch submission

2019-04-03 Thread Christian Heimes


Christian Heimes  added the comment:

The suggested approach is merely a heuristic that reduces the impact of a 
zipbomb. An attacker can circumvent the heuristic. In best case scenario, the 
approach just increases the cost factor for a successful DoS. For example an 
attacker may have to upload 10 larger zip files instead of one smaller zip file 
to fill up the disk space of a server.

The correct approach is to always verify all data from untrusted sources. It's 
the 101 of application security.

--

___
Python tracker 

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



[issue36504] Signed integer overflow in _ctypes.c's PyCArrayType_new()

2019-04-03 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +12605

___
Python tracker 

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



[issue36466] Adding a way to strip annotations from compiled bytecode

2019-04-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

@cary are you planning on updating with the suggested/requested improvements to 
the patch? If not, let us know and we'll see if someone else is interested in 
taking over.

--

___
Python tracker 

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



[issue36518] Avoid conflicts when pass arbitrary keyword arguments to Python function

2019-04-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

This will require a PEP discussion before it can move forward.

--

___
Python tracker 

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



[issue12756] datetime.datetime.utcnow should return a UTC timestamp

2019-04-03 Thread Paul Ganssle


Paul Ganssle  added the comment:

@tin utcnow is a semi-deprecated way to get a naive datetime that represents 
the time in UTC. The preferred replacement is to do this:

from datetime import datetime, timezone

datetime.now(tz=timezone.utc)

Note that you can replace "timezone.utc" with *any* time zone. The result will 
be a timezone-aware time zone representing the current time in the time zone 
passed to the function.

I think because there is already a preferred solution available in the standard 
library, there is no need to add a parameter that would make `utcnow` return an 
aware datetime.

--
nosy: +p-ganssle

___
Python tracker 

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



[issue36440] more helpful diagnostics for parser module

2019-04-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 513d142993bb8c13e6803727fa086e44eafc360f by Pablo Galindo in 
branch '3.7':
[3.7] bpo-36440: include node names in ParserError messages, instead of numeric 
IDs (GH-12565) (GH-12671)
https://github.com/python/cpython/commit/513d142993bb8c13e6803727fa086e44eafc360f


--

___
Python tracker 

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



[issue36440] more helpful diagnostics for parser module

2019-04-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks A. Skrobov for your contribution! :)

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



[issue36440] more helpful diagnostics for parser module

2019-04-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Why was this merged in 3.7? This is a new feature, not a bug fix.

--

___
Python tracker 

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



[issue36504] Signed integer overflow in _ctypes.c's PyCArrayType_new()

2019-04-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset fd83a823a6f268dc97ee2bf7d8a1a88d948446e5 by Serhiy Storchaka 
(Zackery Spytz) in branch '2.7':
bpo-36504: Fix signed integer overflow in _ctypes.c's PyCArrayType_new(). 
(GH-12660) (GH-12678)
https://github.com/python/cpython/commit/fd83a823a6f268dc97ee2bf7d8a1a88d948446e5


--

___
Python tracker 

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



[issue36440] more helpful diagnostics for parser module

2019-04-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Issue #36256 (a real bug) was backported to 3.7 but also includes a similar 
improvement regarding node names in error messages. I can revert it from 3.7 if 
you consider it should not be there.

--

___
Python tracker 

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



[issue36479] Exit threads when interpreter is finalizing rather than runtime.

2019-04-03 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
keywords: +patch
pull_requests: +12606
stage: needs patch -> patch review

___
Python tracker 

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



[issue36489] add filename_extension_map and/or content-types_map dict(s) to mimetypes

2019-04-03 Thread Daniel Black


Daniel Black  added the comment:

Thanks Karthikeyan. That is a bit cumbersome but gets it done. Any value seen 
in adding as proposed?

--

___
Python tracker 

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



[issue6721] Locks in the standard library should be sanitized on fork

2019-04-03 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I'd start with faulthandler.register with all_threads=True and see if that 
gives you what you need.

https://docs.python.org/3/library/faulthandler.html

--

___
Python tracker 

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



[issue36520] Email header folded incorrectly

2019-04-03 Thread Jonathan Horn

New submission from Jonathan Horn :

I encountered a problem with replacing the 'Subject' header of an email. After 
serializing it again, the utf8 encoding was wrong. It seems to be occurring 
when folding the internal header objects.

Example:
>> email.policy.default.fold_binary('Subject', 
>> email.policy.default.header_store_parse('Subject', 'Hello Wörld! Hello 
>> Wörld! Hello Wörld! Hello Wörld!Hello Wörld!')[1])
Expected output: b'Subject: Hello 
=?utf-8?q?W=C3=B6rld!_Hello_W=C3=B6rld!_Hello_W=C3=B6rld!?=\n Hello 
=?utf-8?q?W=C3=B6rld!Hello_W=C3=B6rld!?=\n' (or similar)
Actual output: b'Subject: Hello 
=?utf-8?q?W=C3=B6rld!_Hello_W=C3=B6rld!_Hello_W=C3=B6rld!?=\n Hello 
=?utf-8?=?utf-8?q?q=3FW=3DC3=3DB6rld!Hello=3F=3D_W=C3=B6rld!?=\n'

I'm running Python 3.7.3 on Arch Linux using Linux 5.0.

--
components: email
messages: 339419
nosy: Jonathan Horn, barry, r.david.murray
priority: normal
severity: normal
status: open
title: Email header folded incorrectly
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



[issue18697] Unify arguments names in Unicode object C API documentation

2019-04-03 Thread Rune Tynan


Rune Tynan  added the comment:

Another inconsistency I've noticed is that the code sometimes refers to 
Py_ssize_t instances as a 'length' and sometimes as a 'size'. It seems like 
'size' is the more common one in the docs, but the headers more often use 
'length'. Which would be the better one to keep for the common case?

--

___
Python tracker 

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



[issue36466] Adding a way to strip annotations from compiled bytecode

2019-04-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FYI, this partially breaks functools.singledispatch() and completely breaks 
both typing.NamedTuple() and dataclasses.dataclass().  A user may be able to 
avoid these in their own code, but I don't see how they can avoid it in 
third-party code.

--

___
Python tracker 

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



[issue36521] Consider removing docstrings from co_consts in code objects

2019-04-03 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Function objects provide __doc__ as a documented writeable attribute.  However, 
code objects also have the same information in co_consts[0].  When __doc__ is 
changed, the latter keeps a reference to the old string.  Also, the disassembly 
shows that co_consts[0] is never used.  Can we remove the entry in co_consts?  
It looks like a compilation artifact rather than something that we need or want.


>>> def f(x):
'y'

>>> f.__doc__
'y'
>>> f.__code__.co_consts[0]
'y'
>>> f.__doc__ = 'z'
>>> f.__code__.co_consts[0]
'y'

>>> from dis import dis
>>> dis(f)
  2   0 LOAD_CONST   1 (None)
  2 RETURN_VALUE

--
components: Interpreter Core
messages: 339422
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Consider removing docstrings from co_consts in code objects
type: resource usage
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



[issue36506] [security] CVE-2019-10268: An arbitrary execution vulnerability exists in the built-in function getattr

2019-04-03 Thread bigbigliang

bigbigliang  added the comment:

Thank you for your answer. I am a student and very interested in python. I
want to continue digging for Python bugs, but I am not good at this area. I
want to keep looking for loopholes.

from:bigbigliang

Christian Heimes  于2019年4月3日周三 下午5:33写道:

>
> Christian Heimes  added the comment:
>
> Could you please do us a favor and contact MITRE to get the CVE number
> revoked? Please CC secur...@python.org so we have a record of the emails.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue18697] Unify arguments names in Unicode object C API documentation

2019-04-03 Thread Rune Tynan


Change by Rune Tynan :


--
keywords: +patch
pull_requests: +12607
stage: needs patch -> patch review

___
Python tracker 

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



[issue36522] http/client.py does not print duplicate header values in debug

2019-04-03 Thread Matt Houglum


New submission from Matt Houglum :

This is a follow-up to https://bugs.python.org/issue33365.  The fix for that 
issue (see https://github.com/python/cpython/pull/6611) added a statement to 
also print header values, but it does not account for the case where multiple 
values exist for the same header name, e.g. if my response contained these 
headers:

x-goog-hash: crc32c=KAwGng==
x-goog-hash: md5=eB5eJF1ptWaXm4bijSPyxw==

then the debug output would print whichever of those values is returned from 
`self.headers.get("x-goog-hash")` for both prints:

header: x-goog-hash: crc32c=KAwGng==
header: x-goog-hash: crc32c=KAwGng==

The iteration should instead be done using self.headers.items(), which will 
return the key and value pair to be printed. I'll send a GitHub PR shortly.

--
components: Library (Lib)
messages: 339424
nosy: Matt Houglum
priority: normal
severity: normal
status: open
title: http/client.py does not print duplicate header values in debug
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



[issue36466] Adding a way to strip annotations from compiled bytecode

2019-04-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

One way would be to compile only their own source to bytecode using this flag. 
But I agree it doesn't look very viable in general. I'll talk to Cary offline.

--

___
Python tracker 

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



[issue36466] Adding a way to strip annotations from compiled bytecode

2019-04-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

(I just found out that Cary is on vacation until 4/17.)

--

___
Python tracker 

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



[issue36521] Consider removing docstrings from co_consts in code objects

2019-04-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

co_consts[0] is used for setting the initial value of __doc__. See 
PyFunction_NewWithQualName().

consts = ((PyCodeObject *)code)->co_consts;
if (PyTuple_Size(consts) >= 1) {
doc = PyTuple_GetItem(consts, 0);
if (!PyUnicode_Check(doc))
doc = Py_None;
}
else
doc = Py_None;
Py_INCREF(doc);
op->func_doc = doc;

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue36522] http/client.py does not print duplicate header values in debug

2019-04-03 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue36216] CVE-2019-9636: urlsplit does not handle NFKC normalization

2019-04-03 Thread Steve Dower


Steve Dower  added the comment:

You need a "u" prefix on some of your strings or they're probably being 
immediately decomposed. The result of urlsplit should be unicode on Python 2 
for a Unicode input, and yours are not.

--

___
Python tracker 

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



[issue36054] Way to detect CPU count inside docker container

2019-04-03 Thread Manjusaka


Manjusaka  added the comment:

Yes, not only but also support get real memory limit.

look at 
https://blogs.oracle.com/java-platform-group/java-se-support-for-docker-cpu-and-memory-limits

--

___
Python tracker 

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



[issue36521] Consider removing docstrings from co_consts in code objects

2019-04-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> co_consts[0] is used for setting the initial value of __doc__.

Why is __doc__ set this way, but __name__ is set directly on the function 
object?  Setting __doc__ from the code object seems like an odd implementation 
hack that puts the responsibility in the wrong place and that leaves a dangling 
reference when __doc__ is updated.

--

___
Python tracker 

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



[issue36489] add filename_extension_map and/or content-types_map dict(s) to mimetypes

2019-04-03 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

The docs state the tuple contains two dictionaries depending on how common the 
type is. I guess you want a merged dict to be provided as an API? I will leave 
it to @r.david.murray on that.

--

___
Python tracker 

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



[issue36521] Consider removing docstrings from co_consts in code objects

2019-04-03 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue36522] http/client.py does not print duplicate header values in debug

2019-04-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12610

___
Python tracker 

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



[issue36522] http/client.py does not print duplicate header values in debug

2019-04-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 461c416dd78a98f2bba7f323af8c9738e060b6f2 by Serhiy Storchaka 
(Matt Houglum) in branch 'master':
bpo-36522: Print all values for headers with multiple values. (GH-12681)
https://github.com/python/cpython/commit/461c416dd78a98f2bba7f323af8c9738e060b6f2


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue36216] CVE-2019-9636: urlsplit does not handle NFKC normalization

2019-04-03 Thread Matej Cepl


Matej Cepl  added the comment:

You are right. Thank you.

--

___
Python tracker 

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