Jon Nabozny | 29 May 05:57 2016

[issue27148] Make VENV_DIR relative to Script directory


New submission from Jon Nabozny:

I would like to see some enhancement where the activate.bat and activate scripts allow the script to
determine where the python executable resides.

When the executable cannot be found (because the path doesn't exist for some reason), the system will
ultimately find the installed version of python. This can cause side effects that may be non-obvious to users.

Example:
    User creates a virtual environment:
        python -m venv C:\Location\To\Project venv

     User manually changes location of project:
        xcopy /E C:\Location\To\Project C:\New\Project\Location

     User runs activate.bat:
        (venv) C:\New\Project\Location

     At this point, the user will get the modified prompt, but will         
     actually be using his/her globally installed python. Therefore,
     running anything like pip will taint their install. Further, if
     they had set up the environment previously, it can cause errors
     because modules won't be found (because it's pointing at the
     wrong Lib\site-packages folder).

Code:
    activate.bat
        ;Replace set "VIRTUAL_ENV=__VENV_DIR__"
        set "VIRTUAL_ENV=%~dp0..\"
(Continue reading)

Eric Snow | 28 May 19:53 2016

[issue27147] importlib docs do not mention PEP 420


New submission from Eric Snow:

PEP 420 should be mentioned in the introduction section of the importlib docs.  I'll push a change to fix this
in a minute.

----------
assignee: eric.snow
components: Documentation
messages: 266565
nosy: brett.cannon, eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: importlib docs do not mention PEP 420
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue27147>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

Phil Thompson | 28 May 19:03 2016

[issue27146] posixmodule.c needs stdio.h


New submission from Phil Thompson:

posixmodule.c needs to #include <stdio.h> to get the declaration of ctermid(). On most platforms this
happens as a side effect of including other .h files but does not on Android.

----------
components: Library (Lib)
messages: 266561
nosy: philthompson10
priority: normal
severity: normal
status: open
title: posixmodule.c needs stdio.h
type: compile error
versions: Python 3.6

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue27146>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

Oren Milman | 28 May 17:58 2016

[issue27145] long_add and long_sub might return a new int where &small_ints[x] could be returned


New submission from Oren Milman:

------------ the current state ------------
>>> if is32BitCPython:
...   PyLong_SHIFT = 15
... elif is64BitCPython:
...   PyLong_SHIFT = 30
...
>>> ##### case A #####
>>> a = 2 ** PyLong_SHIFT - 1
>>> b = 2 ** PyLong_SHIFT - 2
>>> a - b
1
>>> a - b is 1
True
>>> a + (-b) is 1
True
>>>
>>> ##### case B #####
>>> a = 2 ** PyLong_SHIFT
>>> b = 2 ** PyLong_SHIFT - 1
>>> a - b
1
>>> a - b is 1
False
>>> a + (-b) is 1
False
>>>
>>> ##### case C #####
(Continue reading)

Julio C Cardoza | 28 May 16:44 2016

[issue27139] Increased test coverage for statistics.median_grouped


New submission from Julio C Cardoza:

I had signed the contributor agreement.!

----------

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue27139>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

SilentGhost | 28 May 16:05 2016

[issue27139] Increased test coverage for statistics.median_grouped


Changes by SilentGhost <ghost.adh <at> runbox.com>:

----------
nosy: +steven.daprano
stage:  -> patch review
type:  -> behavior

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue27139>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

Grzegorz Grzywacz | 28 May 15:25 2016

[issue27144] concurrent.futures.as_completed() memory inefficiency


New submission from Grzegorz Grzywacz:

as_complite generator keeps reference of all passed futures until StopIteration. It may lead to serious
memory inefficiency.

Solution is to remove reference from lists and yield future ad-hoc.

I have submitted patch and reproduce sample.

I can create backport for older versions if needed.

----------
components: Library (Lib)
files: reproduce.py
messages: 266552
nosy: bquinlan, grzgrzgrz3
priority: normal
severity: normal
status: open
title: concurrent.futures.as_completed() memory inefficiency
type: resource usage
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43037/reproduce.py

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue27144>
_______________________________________
_______________________________________________
(Continue reading)

Rubén Rivero Capriles | 28 May 02:26 2016

[issue27143] python 3.5 conflict with Mailman, ebtables and firewalld


New submission from Rubén Rivero Capriles:

My current python version is 3.5 which I installed yesterday. How can I get rid of 2,7. Python 3.5 should be
the one running.

While: Installing mailman.
An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/root/Python-3.5.0/venv/lib/python2.7/site-packages/zc/buildout/buildout.py", line
1992, in main
    getattr(buildout, command)(args)
  File "/root/Python-3.5.0/venv/lib/python2.7/site-packages/zc/buildout/buildout.py", line 666,
in install
    installed_files = self[part]._call(recipe.install)
  File "/root/Python-3.5.0/venv/lib/python2.7/site-packages/zc/buildout/buildout.py", line
1407, in _call
    return f()
  File
"/root/mailman-bundler/eggs/collective.recipe.cmd-0.11-py2.7.egg/collective/recipe/cmd/__init__.py",
line 56, in install
    self.execute()
  File
"/root/mailman-bundler/eggs/collective.recipe.cmd-0.11-py2.7.egg/collective/recipe/cmd/__init__.py",
line 69, in execute
    run_commands(cmds, self.shell)
  File
"/root/mailman-bundler/eggs/collective.recipe.cmd-0.11-py2.7.egg/collective/recipe/cmd/__init__.py",
line 39, in run_commands
(Continue reading)

Julien | 28 May 00:17 2016

[issue27142] Default int value with xmlrpclib / xmlrpc.client


New submission from Julien:

I tried to execute the following code, but `xmlrpclib` is raising an exception:

    >>> import xmlrpclib
    >>> data = """<?xml version="1.0"?> 
    ... <methodCall>
    ...     <methodName>test_method</methodName>
    ...     <params>
    ...         <param>
    ...             <value>
    ...                 <int/>
    ...             </value>
    ...         </param>
    ...     </params>
    ... </methodCall>"""
    >>> xmlrpclib.loads(data)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib64/python2.7/xmlrpclib.py", line 1141, in loads
        p.feed(data)
      File "/usr/lib64/python2.7/xmlrpclib.py", line 558, in feed
        self._parser.Parse(data, 0)
      File "/usr/lib64/python2.7/xmlrpclib.py", line 829, in end
        return f(self, join(self._data, ""))
      File "/usr/lib64/python2.7/xmlrpclib.py", line 864, in end_int
        self.append(int(data))
    ValueError: invalid literal for int() with base 10: ''

(Continue reading)

Bar Harel | 27 May 23:29 2016

[issue27141] Fix collections.UserList shallow copy


New submission from Bar Harel:

I have encountered a weird behavior in collections.UserList.
Using copy.copy() on an instance results in a new instance of UserList but with the same underlying list.
Seems like self.copy() works great but __copy__ was not overridden to allow copy.copy to work too.
The patch just assigns __copy__ to self.copy triggering the correct behavior.

----------
components: Library (Lib)
files: UserList.patch
keywords: patch
messages: 266515
nosy: bar.harel
priority: normal
severity: normal
status: open
title: Fix collections.UserList shallow copy
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43032/UserList.patch

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue27141>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

(Continue reading)

Serhiy Storchaka | 27 May 22:40 2016

[issue27140] Opcode for creating dict with constant keys


New submission from Serhiy Storchaka:

BUILD_MAP, BUILD_MAP_UNPACK and BUILD_MAP_UNPACK_WITH_CALL need pushing key-value pairs on the
stack. If keys and values are not constant, this is correct order of evaluating them. But if keys are
constant (very common case), the order of pushing them doesn't affect semantic. We can pack them in
constant tuple and push on the stack by one instruction.

I think there would be a benefit from adding new opcodes that take a sequence of values and a tuple of keys
instead of a sequence of key-value pairs.

New MAKE_FUNCTION (issue27095) and new CALL_FUNCTION (issue yet not opened) could have a benefit.

----------
components: Interpreter Core
messages: 266511
nosy: Demur Rumed, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Opcode for creating dict with constant keys
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue27140>
_______________________________________
_______________________________________________
(Continue reading)


Gmane