[issue26683] Questionable terminology for describing what locals() does

2016-03-31 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> A national variable maybe :)

I would think that "nonlocal" is exactly the right term given that that is how 
you would declare it if you wanted to write to it.

>>> w = 5

>>> def f(x):
def g(y):
nonlocal x
global w
z = x + y
x += 1
print(locals())
print(globals())
return g

>>> f(10)(20)
{'y': 20, 'x': 11, 'z': 30}
{'w': 5, ...}

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-03-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Agree with Raymond.

float.is_integer(x) is more efficient than x==int(x), but is this method used 
anywhere at all? It was added as a part of issue2224.

--
nosy: +christian.heimes, serhiy.storchaka

___
Python tracker 

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



[issue26684] pathlib.Path.with_name() and .with_suffix do not allow combining with an empty Path

2016-03-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is no a bug. This is the documented and reasonable behavior. What 
behavior you expect?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26682] Ttk Notebook tabs do not show with 1-2 char names

2016-03-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I see the names of the first 4 tabs: 0-3. Tab header for the last tab is empty. 
If use longer name (e.g. "45678") I see it without two last characters ("456").

Yes, it looks as Ttk bug. Have you reported this to the mainstream?

--

___
Python tracker 

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



[issue26683] Questionable terminology for describing what locals() does

2016-03-31 Thread Martin Panter

Martin Panter added the comment:

Regarding “free variables”, in Issue 17546 I proposed the wording “. . . also 
includes non-local, non-global names”.

In your code example, I would consider y to be 100 percent local to the g() 
function. It is a function parameter, and “y += 1” should work. I agree x is 
not a true local, it is a “non-local non-global”. A national variable maybe :)

For functions, considering that you shouldn’t modify the dictionary (original 
concern in Issue 17546), I do agree the behaviour is a bit strange and 
inconsistent. It might have made more sense to either only return true locals, 
or return a complete namespace of locals, non-locals, globals, and builtins. It 
seems there is no way to get a similar list of non-local non-globals in a class 
scope.

--
nosy: +martin.panter

___
Python tracker 

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



[issue26684] pathlib.Path.with_name() and .with_suffix do not allow combining with an empty Path

2016-03-31 Thread Ethan Furman

New submission from Ethan Furman:

The methods .with_name() and .with_suffix() of pathlib.Path (and friends) do 
not allow a name or suffix to be added to a path alone -- I get ValueError(... 
has an empty name...).

This is the documented behavior, but it seems incredibly user-unfriendly.

--
messages: 262717
nosy: ethan.furman, pitrou
priority: normal
severity: normal
status: open
title: pathlib.Path.with_name() and .with_suffix do not allow combining with an 
empty Path
type: behavior
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-03-31 Thread Demur Rumed

Changes by Demur Rumed :


Added file: http://bugs.python.org/file42339/wpy3.patch

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-03-31 Thread Demur Rumed

Changes by Demur Rumed :


Removed file: http://bugs.python.org/file42338/wpy3.patch

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-03-31 Thread Demur Rumed

Demur Rumed added the comment:

Addressed feedback from josh.rosenberg besides reintroducing FOURTH/SET_FOURTH

--
Added file: http://bugs.python.org/file42338/wpy3.patch

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-03-31 Thread Raymond Hettinger

Raymond Hettinger added the comment:

One other thought:  the name is_integer() is inconsistent with the nomenclature 
in numbers.py.  Had this been included at the outset, its name would have been 
is_integral().

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-03-31 Thread Raymond Hettinger

Raymond Hettinger added the comment:

-0 

I question whether we ever needed a short-cut for x==int(x).  Adding this to 
the numeric tower would cause it to propagate broadly including the int type.  
To me, this seems like feature creep resulting in language bloat.  

The decimal module has been around for a long time and no one has ever 
requested the feature.  This suggests it would be just another unused method in 
a module that already has learnability and usability problems due to a fat API.

--

___
Python tracker 

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



[issue26683] Questionable terminology for describing what locals() does

2016-03-31 Thread Raymond Hettinger

New submission from Raymond Hettinger:

The docs for locals() say that inside a function that local variables and free 
variables are included:  https://docs.python.org/3/library/functions.html#locals

Elsewhere we use the terms "cell variables" or "nonlocals".   Mathematically, 
the word "free" means unbound, so that isn't applicable here and isn't the 
usual way of describing variables in the enclosing scope.

>>> def f(x):
def g(y):
z = x + y
print(locals())
return g

>>> f(10)(20)
{'x': 10, 'y': 20, 'z': 30}

Also, I'm not sure why "x" and "y" are included in the definition for locals(). 
 That seems strange given that "x" and "y" are not local to "g" and that "x += 
1" would fail with an UnboundLocalError.

--
assignee: docs@python
components: Documentation
messages: 262713
nosy: docs@python, rhettinger
priority: normal
severity: normal
status: open
title: Questionable terminology for describing what locals() does
versions: Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue26682] Ttk Notebook tabs do not show with 1-2 char names

2016-03-31 Thread Terry J. Reedy

New submission from Terry J. Reedy:

>From 
>https://stackoverflow.com/questions/36336010/cannot-see-all-tabs-in-ttk-notebook

import tkinter as tk
from tkinter.ttk import Frame, Notebook

root = tk.Tk()
nb = Notebook(root, width=320, height=240)
nb.pack(fill='both', expand=1)
page0 = Frame(nb)
page1 = Frame(nb)
page2 = Frame(nb)
page3 = Frame(nb)
page4 = Frame(nb)
nb.add(page0, text="0")
nb.add(page1, text="1")
nb.add(page2, text="2")
nb.add(page3, text="3")
nb.add(page4, text="4")

Only tabs 0 and 1 show.  Add a space before or after the number and 2 & 3 show. 
 Add 6 spaces after 4 and '4 ' shows.  Appears to work OK with 3 chars, with 
first and third non-blank.

I presume this is a ttk bug.  
http://www.tcl.tk/man/tcl8.6/TkCmd/ttk_notebook.htm#M14 just says 'a string'.  
I plan to close this as 3rd party in a few days, but I wanted to document the 
defacto spec here on the tracker.

--
components: Tkinter
messages: 262712
nosy: serhiy.storchaka, terry.reedy, wordtech
priority: normal
severity: normal
status: open
title: Ttk Notebook tabs do not show with 1-2 char names
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue26681] decorators for attributes

2016-03-31 Thread Ethan Furman

Ethan Furman added the comment:

Please discuss this idea on the Python-Ideas mailing list first; if that goes 
well you can bring the idea to Python-Dev; if that also goes well feel free to 
reopen this issue.

---

In the meantime you could probably do something with a custom descriptor/class 
decorator pair; if you need help with that you could try the Python-List or 
StackOverflow.

--
nosy: +ethan.furman
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



[issue22854] Documentation/implementation out of sync for IO

2016-03-31 Thread Martin Panter

Changes by Martin Panter :


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



[issue26681] decorators for attributes

2016-03-31 Thread Matthias welp

New submission from Matthias welp:

This is a suggestion, and not final. 

The current ways to define the getter and setter methods for an attribute are 
these two: 

@property
def name():
""" Docstring """
pass

@name.setter
def name(value):
pass

@name.deleter
def name(value):
pass

and

name = property(getter, setter, deleter, docstring)

Of the two ways you can create a property, only the second one allows you to 
use your method definition multiple times, as seen here:

value = property(getter, setter, deleter)
value_2 = property(getter, setter, deleter)

but this has the drawback that it can only use defined method. You can go 
around by defining a wrapper method, but even then you will have to put the 
value of your attribute inside the parenthesis of your behaviour definition, 
or put another assignation statement into your file. To prevent this, I propose 
the addition of decorators to attributes, which would behave like the 
decorators on functions:

class Decorator(object):
def __init__(self, ref):
self.val = ref

def __get__(self):
return self.val

def __set__(self, val):
self.val = val

def __del__(self):
del self.val

@Decorator
val = value

@Decorator
val_2 = value_2

This should behave just like decorators on functions, but then with the 
functionality of attributes. In the proposed __init__ method ref would be the 
attribute after the evaluation of its declaration, similar to function 
decorators.

The main benefit of this would be that the definition of attributes that behave 
in a similar way (get-, set- and delete-behaviour is the same) you only have to 
define one decorator for multiple attributes and you can change the behaviour 
of your attributes in a more intuitive way. 

The current alternatives are these:

class Decorator(object):
def __init__(self, ref):
self.val = ref

def __get__(self):
return self.val

def __set__(self, val):
self.val = val

def __del__(self):
del self.val

@Decorator
def val():
pass

@Decorator
def val_2():
pass

and

def decorate(value):
_value = value
def get():
return _value
def set(value):
_value = value
def del():
del _value
return property(get, set, del)

@decorate
def val():
pass

val_2 = decorate(1)

val_3 = decorate()
val_3 = 20

I think it is weird that to create an attribute that is decorated, I need to 
create a function, or need to explicitely call the decorator. This is why the 
decorators were added for functions, I think it might as well be added for 
attributes.

--
components: Interpreter Core
messages: 262710
nosy: Matthias welp
priority: normal
severity: normal
status: open
title: decorators for attributes
type: enhancement

___
Python tracker 

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



[issue26678] Incorrect linking to elements in datetime package

2016-03-31 Thread Martin Panter

Martin Panter added the comment:

Currently the “datetime” documentation has quick descriptions of classes marked 
up with “.. class::” in the introduction, and then dedicated sections with more 
details. Many other parts of Python’s documentation have a similar structure.

IMO it is better to include the “.. class::” markup closer to the list of 
methods, and then each method can be indented underneath it. See my changes to 
the “socketserver” documentation (Issue 15608, compare 3.4 vs 3.5) where I 
indented a whole lot of methods under class definitions. I suspect the reason 
why things are not like this is just that it is leftover from a conversion from 
an earlier markup format.

The earlier class introductions are also marked up with :noindex:, which would 
explain which become link targets.

Dunno about your intersphinx stuff though. Is that linking to the Python 
documentation from external projects?

--
nosy: +martin.panter

___
Python tracker 

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



[issue22854] Documentation/implementation out of sync for IO

2016-03-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b3c79e0ba477 by Martin Panter in branch '3.5':
Issue #22854: Fix logic for skipping test
https://hg.python.org/cpython/rev/b3c79e0ba477

New changeset de8412dc477e by Martin Panter in branch 'default':
Issue #22854: Merge test fix from 3.5
https://hg.python.org/cpython/rev/de8412dc477e

--

___
Python tracker 

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



[issue26606] logging.baseConfig is missing the encoding parameter

2016-03-31 Thread Vinay Sajip

Vinay Sajip added the comment:

> requires much more coding

Much more? How so? It just seems like one open() call and passing the result to 
basicConfig().

--

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-03-31 Thread Aviv Palivoda

Changes by Aviv Palivoda :


Added file: 
http://bugs.python.org/file42337/hashlib-script-mod-md5sum-style-2.patch

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-03-31 Thread Aviv Palivoda

Aviv Palivoda added the comment:

Thanks for the review SilentGhost. I am including the patch after the changes 
from your CR comments.

--

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-03-31 Thread Christian Heimes

Christian Heimes added the comment:

Threading doesn't make much sense here. The runtime of hash computation is 
usually dominated by I/O performance. On a typical consumer computer SSDs have 
a sequential read performance of 200 to 500 MiB/sec. SHA-512 performance 
between 100 to 150 Mib/sec. Threading could make parallel computation a bit 
faster, but at the cost of a much more complex implementation. Let's keep it 
simple.

Both Python's hashlib implementation and OpenSSL aren't the best foundation if 
you are aiming for maximum performance. All libraries do couple of malloc()s, 
memcpy() and have additional overheads, too.

And please don't use MD5 in your examples. Go for sha256.

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-03-31 Thread SilentGhost

Changes by SilentGhost :


--
components: +Extension Modules
nosy: +facundobatista, mark.dickinson, rhettinger, skrah
stage:  -> patch review
versions: +Python 3.6

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-03-31 Thread Robert Smallshire

Robert Smallshire added the comment:

Adding the second patch file.

--
Added file: http://bugs.python.org/file42336/is_integer_decimal.patch

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-03-31 Thread SilentGhost

SilentGhost added the comment:

The mailing system is acting up, so just for the record, I've left comments on 
rietveld regarding md5sum-style patch.

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2016-03-31 Thread Robert Smallshire

New submission from Robert Smallshire:

When the useful float.is_integer method was added the opportunity was missed to 
incorporate this method into the numeric tower defined in numbers.py. This 
increased the API distance between different number types, making them less 
substitutable than previously, leading to what might be considered to be absurd 
behaviour:

  >>> a = 5.0
  >>> b = 5
  >>> a.is_integer()
  True
  >>> b.is_integer()
  Traceback (most recent call last):
File "", line 1, in 
  AttributeError: 'int' object has no attribute 'is_integer'

The first attached patch modifies Python to:

 1) Implement int.is_integer() to always return True
 2) Add Real.is_integer() as an abstract method in numbers.py
 3) Provide a default implementation in Rational.is_integer() in numbers.py
 4) Adds tests for is_integer() for int and Fraction.
 5) Documentation changes commensurate with above.

Although the Decimal type deliberately lies outside the numeric tower for 
reasons not relevant here, the principle of least surprise suggests that it too 
should support is_integer().  In fact, the implementation already contains just 
such a function, although it is not exposed to Python.  The second patch 
implements is_integer() for both the pure Python and C implementations of 
Decimal, again with commensurate tests and documentation changes.

I hope these changes can be implemented to reduce the degree of surprise 
encountered when working with different number types in Python.

--
components: Library (Lib)
files: is_integer_numeric_tower.patch
keywords: patch
messages: 262702
nosy: Robert Smallshire2
priority: normal
severity: normal
status: open
title: Incorporating float.is_integer into the numeric tower and Decimal
type: enhancement
Added file: http://bugs.python.org/file42335/is_integer_numeric_tower.patch

___
Python tracker 

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



[issue26679] curses: Descripton of KEY_NPAGE and KEY_PPAGE inverted

2016-03-31 Thread Robert Bachmann

New submission from Robert Bachmann:

The table on 
lists:
__
Page Up KEY_NPAGE
Page Down   KEY_PPAGE
__

it should be vice versa.

--
assignee: docs@python
components: Documentation
files: curses.patch
keywords: patch
messages: 262701
nosy: Robert Bachmann, docs@python
priority: normal
severity: normal
status: open
title: curses: Descripton of KEY_NPAGE and KEY_PPAGE inverted
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42334/curses.patch

___
Python tracker 

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



[issue26606] logging.baseConfig is missing the encoding parameter

2016-03-31 Thread Jānis Šlapiņš

Jānis Šlapiņš added the comment:

Using the stream or other options requires much more coding (for example, an 
additional redirection of sys.stdout to a file) instead of just one line with 
the basicConfig.

In the meanwhile, I tried to use logging.FileHandler instead where I could 
specify the encoding in parameters and it works as I wanted when used the 
basicConfig method.

Anyway, it would be nice to have the encoding parameter among the basicConfig 
parameters when logging to files.

--

___
Python tracker 

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



[issue26488] hashlib command line interface

2016-03-31 Thread Aviv Palivoda

Aviv Palivoda added the comment:

I am adding a new patch with a API compatible to GNU md5sum:

$ python -m hashlib md5 /bin/sh
$ d985d0ea551c1253c2305140c583d11f /bin/sh

I will soon add the feature's requested by Victor:
  1) The check option.
  2) Running the hash calculation for different files in different threads.

If anyone would like any other feature he thinks will be helpful please post it.

If we choose to use this API we should remove the dependency on issue 14156.

--
Added file: 
http://bugs.python.org/file42333/hashlib-script-mod-md5sum-style.patch

___
Python tracker 

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



[issue26678] Incorrect linking to elements in datetime package

2016-03-31 Thread Andy Maier

New submission from Andy Maier:

Hi, I did search for these in the open bugs, but did not find any matching bug.

I have a project that revealed that some of its InterSphinx links to existing 
classes/types or methods to not resolve their targets, or to resolve to a 
target that is not the right one (IMO).

This issue here describes everything I found in the datetime package.

Line numbers in this issue apply to the datetime.rst file as of commit 
96a98bcaac70 
(https://hg.python.org/cpython/file/96a98bcaac70/Doc/library/datetime.rst).

* class datetime.tzinfo:

  An intersphinx link to it gets resolved but targets the short description of 
the class in the intro (line 106 of datetime.rst), and I did not find a way to 
target the full description (line 1552), which is really what this should be 
resolved to (IMO).

  I suspect that this has to do with the fact that this class has only one 
anchor on its short description on line 106, while companion classes such as 
datetime.datetime have two anchors (lines 91 and 681) where the last one wins 
(and happens to be the long description). However, see the next item.

* class datetime.timezone:

  Same issue as for class datetime.tzinfo; links get resolved but land on the 
short intro. However, this time there are two anchors (lines 113 and 1795). So 
maybe my suspicion above is rather speculation...

* method datetime.tzinfo.utcoffset:

  An intersphinx link to it does not get resolved. On line 1579 in 
datetime.rst, there is a `.. method:: tzinfo.utcoffset(dt)` but at least these 
intersphinx links did not get resolved:

  :func:`py:tzinfo.utcoffset`
  :func:`py:datetime.tzinfo.utcoffset`

  Do method anchors need the anchor for their defining class close by to work? 
Which because if the first issue above, would be the short version of it, way 
above. (Again speculation)

* Same for method datetime.tzinfo.dst

--
assignee: docs@python
components: Documentation
messages: 262698
nosy: andymaier, docs@python
priority: normal
severity: normal
status: open
title: Incorrect linking to elements in datetime package
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue26632] __all__ decorator

2016-03-31 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Mar 25, 2016, at 02:12 AM, Eryk Sun wrote:

>I added a prototype to Python/bltinmodule.c that gets or creates the __all__
>list from the current globals (i.e. PyEval_GetGlobals).

Hi Eryk.  Can you post your diff to bltinmodule.c?  I'd like to see your code.

>It accepts at most one positional argument and any number of keyword
>arguments. It adds the positional argument's __name__ to __all__, sets it in
>globals, and returns a reference for use as a decorator. The keyword argument
>dict is used to update globals and extend __all__.

I like this.  The dual functionality of `public` looks like it will handle
almost all use cases.  I think we're in widespread agreement about the
decorator, and the keyword arguments are a nice approach to public constants.

I guess I'm a little less sure about the positional argument API.  In adding
@public to Mailman, I noticed there are a few public names which are
instances.  These could be "publicized" with the keyword argument approach,
but I don't think they can work as positional arguments, because the instances
themselves don't have __name__s.  For example, currently:

factory = DateFactory()
factory.reset()
today = factory.today
now = factory.now
layers.MockAndMonkeyLayer.register_reset(factory.reset)

__all__.extend([
'factory',
'now',
'today',
])

With only keyword arguments, which isn't bad:

public(factory=DateFactory())
factory.reset()
public(today=factory.today, now=factor.now)

What's the use case for positionals?

>The positional argument must have a __name__ that's a string:

Right.  But what class of objects does that cover that isn't already covered
(or that explicitly appending to __all__ is good enough)?

--

___
Python tracker 

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



[issue26677] pyvenv: activate.fish breaks $PATH for bash scripts

2016-03-31 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +vinay.sajip
type:  -> behavior

___
Python tracker 

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



[issue26677] pyvenv: activate.fish breaks $PATH for bash scripts

2016-03-31 Thread Florian Dold

New submission from Florian Dold:

When sourcing the activate script from bash, $PATH is restored from 
$_OLD_VIRTUAL_PATH.  If bash was invoked from fish (e.g. when running a shell 
script), and a virtualenv was activated from fish via activate.fish, the 
$_OLD_VIRTUAL_PATH will contain path separated by the ascii record separator 
char (chr(30)), since this is how the fish shell stores arrays.

But the activate script for bash will then set $PATH to $_OLD_VIRTUAL_PATH, 
which breaks most bash scripts.

Instead the activate scripts should differentiate between

$_OLD_BASH_VIRTUAL_PATH
and
$_OLD_FISH_VIRTUAL_PATH

or the activate.fish should take care to replace chr(30) with colons before it 
sets $_OLD_VIRTUAL_PATH.


bash$ pyvenv my-venv
bash$ fish
fish$ . my-venv/bin/activate.fish
fish$ bash
bash$ . my-venv/bin/activate
# $PATH is now broken, since it contains record separators instead of colons to 
separate paths

--
components: Library (Lib)
messages: 262696
nosy: Florian.Dold
priority: normal
severity: normal
status: open
title: pyvenv: activate.fish breaks $PATH for bash scripts
versions: Python 3.5

___
Python tracker 

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



[issue26671] Clean up path_converter in posixmodule.c

2016-03-31 Thread Larry Hastings

Larry Hastings added the comment:

I approve in principle, but this patch isn't ready.

If we compile on Win32, and allow_fd is on, and they pass in an invalid fd, 
your patched code will reach line 914 "length = PyBytes_GET_SIZE(bytes);" but 
bytes will be uninitialized.

--

___
Python tracker 

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



[issue26492] Exhausted array iterator should left exhausted

2016-03-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue26494] Double deallocation on iterator exhausting

2016-03-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
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



[issue22854] Documentation/implementation out of sync for IO

2016-03-31 Thread Martin Panter

Martin Panter added the comment:

I gave up on porting the fix to 2.7. Python 3 raises UnsupportedOperation 
(which inherits ValueError) in many cases due to Issue 9293, but Python 2 
raises IOError (which does not inherit ValueError). Changing how 
BufferedWriter.read() etc work in Python 2 would break test_io_after_close(). 
Also, none of the doc strings in Python 2 need fixing.

Also according to the buildbots, Windows can seek in pipes. Or at least tell() 
doesn’t raise an exception. So I skipped the seek testing on Windows.

--
versions:  -Python 2.7

___
Python tracker 

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



[issue22854] Documentation/implementation out of sync for IO

2016-03-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 66765a49465f by Martin Panter in branch '3.5':
Issue #22854: Skip pipe seek tests on Windows
https://hg.python.org/cpython/rev/66765a49465f

New changeset 3b7811b58a1f by Martin Panter in branch 'default':
Issue #22854: Merge Windows pipe skipping from 3.5
https://hg.python.org/cpython/rev/3b7811b58a1f

--

___
Python tracker 

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



[issue22854] Documentation/implementation out of sync for IO

2016-03-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fb10d1f5016e by Martin Panter in branch 'default':
Issue #22854: Skip pipe seekable() tests on Windows
https://hg.python.org/cpython/rev/fb10d1f5016e

--

___
Python tracker 

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



[issue26655] pathlib glob case sensitivity issue on Windows

2016-03-31 Thread SilentGhost

Changes by SilentGhost :


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



[issue22854] Documentation/implementation out of sync for IO

2016-03-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3d9d9ca75a31 by Martin Panter in branch '2.7':
Issue #22854: fileno() is always required in IOBase; remove test
https://hg.python.org/cpython/rev/3d9d9ca75a31

--

___
Python tracker 

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



[issue22854] Documentation/implementation out of sync for IO

2016-03-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dc9e5f09ac0c by Martin Panter in branch '3.5':
Issue #22854: Clarify documentation about UnsupportedOperation and add tests
https://hg.python.org/cpython/rev/dc9e5f09ac0c

New changeset c27e9dcad1a3 by Martin Panter in branch 'default':
Issue #22854: Merge UnsupportedOperation fixes from 3.5
https://hg.python.org/cpython/rev/c27e9dcad1a3

--
nosy: +python-dev

___
Python tracker 

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



[issue26676] Add missing XMLPullParser to ElementTree.__all__

2016-03-31 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

LGTM.

--
assignee:  -> martin.panter
nosy: +serhiy.storchaka
stage: patch review -> commit review

___
Python tracker 

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



[issue23883] __all__ lists are incomplete

2016-03-31 Thread Martin Panter

Changes by Martin Panter :


--
dependencies: +Add missing XMLPullParser to ElementTree.__all__

___
Python tracker 

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



[issue26676] Add missing XMLPullParser to ElementTree.__all__

2016-03-31 Thread Martin Panter

Changes by Martin Panter :


--
components: XML
files: elementtree-all.patch
keywords: patch
nosy: martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: Add missing XMLPullParser to ElementTree.__all__
versions: Python 3.6
Added file: http://bugs.python.org/file42332/elementtree-all.patch

___
Python tracker 

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