[issue17973] FAQ entry for: '+=' on a list inside tuple both succeeds and raises an exception

2013-06-01 Thread Andy Chugunov

Andy Chugunov added the comment:

Thank you guys for all the efforts you put in solving and answering this.

Just so that we're clear.
It is perfectly legitimate to extend lists withing tuples. It just doesn't seem 
possible to make augmented assignment and simple assignment handle this 
particular operation correctly without unduly sacrificing their general 
efficiency. Use append() on the lists instead.

Is that correct?

--

___
Python tracker 

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



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-01 Thread Charles-François Natali

Charles-François Natali added the comment:

To reproduce the issue, try this:
# echo  > /proc/sys/kernel/hostname

> the locale encoding + surrogateescape error handler

Sounds reasonable.

--
nosy: +neologix

___
Python tracker 

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



[issue18113] Memory leak in curses.panel

2013-06-01 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Extension Modules
keywords: +easy
nosy: +serhiy.storchaka
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.4

___
Python tracker 

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



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-01 Thread Dominik Richter

Dominik Richter added the comment:

@neologix: (with current hostname showing at the left of my prompt)

none:~ #> echo hât > /proc/sys/kernel/hostname
hât:~ #> hostname
hât

--

___
Python tracker 

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



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-01 Thread Dominik Richter

Dominik Richter added the comment:

/off: nevermind, wasn't directed at me

--

___
Python tracker 

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



[issue18110] Nested set comprehensions in class scope fail

2013-06-01 Thread Eric Wieser

Changes by Eric Wieser :


--
status: closed -> open

___
Python tracker 

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



[issue18110] Nested set comprehensions in class scope fail

2013-06-01 Thread Eric Wieser

Eric Wieser added the comment:

This is not at first glance, a duplicate of 3692 - in that case, the list 
comprehension is referring to another class variable.

Most notably, that describes a behavioural change introduced by python 3 - in 
this case, python 3 handles it correctly - there's a bug in the python 2 
implementation.

--
resolution: duplicate -> 

___
Python tracker 

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



[issue1772673] Replacing char* with const char*

2013-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch is outdated. Some function prototypes were changed in issue9369, some 
were changed before.

Here is a new patch. It adds const qualifier to following public functions:
PyObject_DelAttrString, PyObject_HasAttrString, PyObject_GetAttrString, 
PyObject_SetAttrString, PyObject_DelItemString, PyMapping_DelItemString, 
PyMapping_HasKeyString, PyMapping_GetItemString, PyMapping_SetItemString, 
PyFile_FromFd, PyImport_ExecCodeModule, PyImport_ExecCodeModuleEx, 
PyImport_ExecCodeModuleWithPathnames, PyImport_ImportFrozenModule, 
PyLong_FromString, PyOS_strtoul, PyOS_strtol, PyOS_Readline, 
PyMarshal_ReadObjectFromString, PyParser_ParseFile, PyParser_ParseFileFlags, 
PyParser_ParseFileFlagsEx, PyTokenizer_FromFile. It also changes prototypes of 
some internal functions and structures and fixes documentation for 
PyDict_DelItemString. Some of functions already were documented with const 
qualifier.

--
nosy: +brett.cannon, eric.snow, ncoghlan
stage: needs patch -> patch review
Added file: http://bugs.python.org/file30440/const_char_2.patch

___
Python tracker 

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



[issue18020] html.escape 10x slower than cgi.escape

2013-06-01 Thread Ezio Melotti

Changes by Ezio Melotti :


--
assignee:  -> ezio.melotti
stage:  -> patch review

___
Python tracker 

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



[issue17973] FAQ entry for: '+=' on a list inside tuple both succeeds and raises an exception

2013-06-01 Thread R. David Murray

R. David Murray added the comment:

I believe that summary is correct.

--

___
Python tracker 

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



[issue16450] test_missing_localfile masks problems in urlopen

2013-06-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 60c195e89c88 by Senthil Kumaran in branch '2.7':
Fix #16450 test_missing_localfile testcase fails on misconfigured hostname.
http://hg.python.org/cpython/rev/60c195e89c88

--
nosy: +python-dev

___
Python tracker 

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



[issue16450] test_missing_localfile masks problems in urlopen

2013-06-01 Thread Senthil Kumaran

Senthil Kumaran added the comment:

I noticed this only after I had a misconfigured hostname on my mac.
Fixing my hostname of course solved the problem, but in any case, changed the 
tests so that we wont be baffled by the unexpected (and misdirected error msg) 
from test for misconfigured hostname.

Thanks for bug report, Hans Mulder and sorry for taking long time to get to 
this.

--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue17967] urllib2.open failed to access a url when a perent directory of the url is permission denied

2013-06-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0a544bb539e6 by Senthil Kumaran in branch '2.7':
Fix #17967: For ftp urls CWD to target instead of hopping to each directory
http://hg.python.org/cpython/rev/0a544bb539e6

New changeset dbfbdf2b5c19 by Senthil Kumaran in branch '3.3':
Fix #17967: For ftp urls CWD to target instead of hopping to each directory
http://hg.python.org/cpython/rev/dbfbdf2b5c19

New changeset c1101f0d6c29 by Senthil Kumaran in branch 'default':
merge from 3.3
http://hg.python.org/cpython/rev/c1101f0d6c29

--
nosy: +python-dev

___
Python tracker 

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



[issue17967] urllib2.open failed to access a url when a perent directory of the url is permission denied

2013-06-01 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Thanks Zhaoqifa for steps to configure the ftp with acl. I could reproduce it 
manually and fix it by changes to the urllib.request code.
Unfortunately, we dont have rigorous tests for ftp handling in urllib module. 
That's noted in test_urllib2net module too.

This bug is fixed in all branches.

--
resolution:  -> fixed
stage: test needed -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue17967] urllib2.open failed to access a url when a perent directory of the url is permission denied

2013-06-01 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Reopening: This change is seeing problems with Windows Buildbot
http://buildbot.python.org/all/builders/x86%20XP-4%203.x/builds/8643/steps/test/logs/stdio

--
status: closed -> open

___
Python tracker 

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



[issue17683] socket.getsockname() inconsistent return type with AF_UNIX

2013-06-01 Thread Charles-François Natali

Changes by Charles-François Natali :


--
nosy: +haypo

___
Python tracker 

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



[issue18066] Remove SGI-specific code from pty.py

2013-06-01 Thread A.M. Kuchling

Changes by A.M. Kuchling :


--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue18066] Remove SGI-specific code from pty.py

2013-06-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a678f139510b by Andrew Kuchling in branch 'default':
#18066: remove vestigial code depending on the sgi module
http://hg.python.org/cpython/rev/a678f139510b

--
nosy: +python-dev

___
Python tracker 

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



[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

To me, there are two independent improvements: using i and hence msg to 
identify the erroneous dup, and using .subTest to test all dups. I would 
combine ideas from both the first two patches to do both.

1. a fancy formatted message would be more useful with less fluff and the two 
displays each on their own line.

msg = "iteration %s\ncopy: %s\norig: %s" % (i, dup, words)
# or od for OrderedDict test

2. within both loops, add msg to all asserts as in the first patch. If there is 
a failure, one would want to know both the source of the dup (indicated by i) 
and the content, and how it differed from the model.

3. wrap the bodies of both loops with 'with self.subTest():' to always test all 
dups. Unrolling the loops prevents doing this.

Test the revised tests by temporarily adding both the original (failing the 
'is' test) and a partial and therefore faulty copy of the original to both list 
of dups. Verify that both errors are reported for each and that the message 
formatting looks ok.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

subTest() serves two purposes: identify the test case and continue testing
oother test cases after a fail. For first purpose subTest() is not well
suitable in these tests, becouse we have no a string which determine a
test. Second purpose is not relevant to original issue.

1. a fancy formatted message would be more useful with less fluff and the
> two displays each on their own line.
>
> msg = "iteration %s\ncopy: %s\norig: %s" % (i, dup, words)
> # or od for OrderedDict test
>

When the test fails, dup is not expected value and printing it can raise an
exception and prevent formatting useful error message. Failure report
should be succesful in any case.

3. wrap the bodies of both loops with 'with self.subTest():' to always test
> all dups. Unrolling the loops prevents doing this.
>

Of course you can wrap a body of the check() function.

--

___
Python tracker 

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



[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

> becouse we have no a string which determine a test.

The original loop could be have been written as (or be changed to)

for label, dup in [
('odcopy', od.copy()),
('copycopy', copy.copy(words)),

]
and the label used to identify the test, whether passed to assertX or subTest. 
The test author (Raymond H.) thought the sequence number enough in the off 
chance there ever were a failure.

>When the test fails, dup is not expected value and printing it can raise an 
>exception and prevent formatting useful error message.

I do not understand this, unittest assumes that tested objects are printable. 
Indeed, assertEqual(dup, words/od) will do that (making the message redundant 
for this particular test.

So I think the best fix would be to redo the loop header as above, pass label 
to subTest so it appears for any failure (which intertwines subTest with this 
issue), and only pass a message to assert where actually needed (like the len 
test).

--

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2013-06-01 Thread Donald Stufft

Changes by Donald Stufft :


--
nosy: +dstufft

___
Python tracker 

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



[issue11959] smtpd cannot be used without affecting global state

2013-06-01 Thread Vinay Sajip

Changes by Vinay Sajip :


Added file: http://bugs.python.org/file30441/d7c50c15468d.diff

___
Python tracker 

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



[issue18050] embedded interpreter or virtualenv fails with "ImportError: cannot import name MAXREPEAT"

2013-06-01 Thread H Xu

Changes by H Xu :


--
nosy: +xuhdev

___
Python tracker 

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



[issue11959] smtpd cannot be used without affecting global state

2013-06-01 Thread Vinay Sajip

Vinay Sajip added the comment:

Patch now updated to revert asyncore changes. The changes are now:

smtpd.py - changed SMTPChannel and SMTPServer to accept map argument

test_logging.py - removed subclassed SMTPChannel, not needed since the base 
SMTPChannel class now accepts a map, and simplified TestSMTPServer, since the 
base SMTPServer class now accepts a map.

--

___
Python tracker 

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



[issue15903] Make rawiobase_read() read directly to bytes object

2013-06-01 Thread Dwight Guth

Dwight Guth added the comment:

I was programming something today and thought I should let you know I came 
across a situation where the current behavior of this function is able to 
expose what seems to be raw memory to the user.

import io
class A(io.RawIOBase):
  def readinto(self, b):
return len(b)

A().read(100)

--
nosy: +dwight.guth

___
Python tracker 

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-01 Thread Nikolaus Rath

New submission from Nikolaus Rath:

[0] nikratio@vostro:~/tmp$ cat bugme.py 
#!python
import getpass
import warnings

warnings.simplefilter('default')
getpass.getpass("What's up?")

[0] nikratio@vostro:~/tmp$ python3 --version
Python 3.3.2

[0] nikratio@vostro:~/tmp$ python3 bugme.py 
/usr/lib/python3.3/os.py:1043: ResourceWarning: unclosed file <_io.FileIO 
name=3 mode='rb+'>
  return io.open(fd, *args, **kwargs)
What's up?

--
components: Library (Lib)
messages: 190458
nosy: Nikratio
priority: normal
severity: normal
status: open
title: getpass.getpass() triggers ResourceWarning
type: resource usage
versions: Python 3.3

___
Python tracker 

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-01 Thread Alex Gaynor

Alex Gaynor added the comment:

Attached patch should fix this issue.

--
keywords: +patch
nosy: +alex
Added file: http://bugs.python.org/file30442/issue18116.diff

___
Python tracker 

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-01 Thread Nikolaus Rath

Nikolaus Rath added the comment:

No, it doesn't.

--

___
Python tracker 

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-01 Thread Alex Gaynor

Alex Gaynor added the comment:

Are you sure you applied it correctly? With and without:

Alexanders-MacBook-Pro:cpython alex_gaynor$ ./python.exe x.py
What's up?
Alexanders-MacBook-Pro:cpython alex_gaynor$ hg revert --all --no-backup
reverting Lib/getpass.py
Alexanders-MacBook-Pro:cpython alex_gaynor$ ./python.exe x.py
What's up?
x.py:6: ResourceWarning: unclosed file <_io.TextIOWrapper name=3 mode='w+' 
encoding='UTF-8'>
  getpass.getpass("What's up?")

--

___
Python tracker 

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-01 Thread Nikolaus Rath

Nikolaus Rath added the comment:

Yes, I'm pretty sure:

[0] nikratio@vostro:~/tmp$ cp  /usr/lib/python3.3/getpass.py  .
[0] nikratio@vostro:~/tmp$ patch -p2 < issue18116.diff 
patching file getpass.py
Hunk #1 succeeded at 57 (offset -1 lines).

[0] nikratio@vostro:~/tmp$ python3 bugme.py 
/usr/lib/python3.3/os.py:1043: ResourceWarning: unclosed file <_io.FileIO 
name=3 mode='rb+'>
  return io.open(fd, *args, **kwargs)
What's up?

# Test if we're using the patched getpass.py...
[0] nikratio@vostro:~/tmp$ vim getpass.py
[0] nikratio@vostro:~/tmp$ python3 bugme.py 
Hello
/usr/lib/python3.3/os.py:1043: ResourceWarning: unclosed file <_io.FileIO 
name=3 mode='rb+'>
  return io.open(fd, *args, **kwargs)
What's up?

--

___
Python tracker 

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



[issue17855] Implement introspection of logger hierarchy

2013-06-01 Thread Brandon Craig Rhodes

Brandon Craig Rhodes added the comment:

Adding an entirely separate API for introspection strikes me as 
counter-productive — instead of merely having to maintain the logging API that 
you already maintain, you will additionally now have an entirely separate and 
second API that also has to be maintained forever.

Reading back over the current logging documentation, it looks like the problem 
is that the documentation only includes verbs — the methods that can be invoked 
— but not adjectives: the attributes that are attached to each logger, handler, 
and filter. This is contrary to modern Python APIs, which typically document 
their attributes and offer direct access to them; within the Standard Library, 
cf the threading.Thread object for one that has done a good job of moving into 
the modern world with directly-accessible attributes.

So my guess would be that you should discard the idea of a separate 
introspection API, and simply document that attributes of each logger, handler, 
and filter that today are already perfectly introspectable. Check out the 
logging_tree code if you want to make sure that you are “promoting” into 
document-hood all of the attributes that I needed in order to do my 
introspecting there.

--

___
Python tracker 

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



[issue18111] Add a default argument to min & max

2013-06-01 Thread Julian Berman

Julian Berman added the comment:

Thanks for finding that, I thought there was an issue that came out of that p-i 
thread but couldn't find it.

I'd like to be more concrete, but "calling max on an iterable" seems concrete 
enough to me. If you'd like to know more though, personally I've wanted this at 
least twice in the past 4 or 5 months. Currently, I have code that looks like:

def best_match(stuff):
first = next(stuff, None)
if first is None:
return
return max(itertools.chain([first], stuff))

which finds the best matching (error it happens to be) in the given stuff. A 
few months ago I had a similar need in a different application.

The issues in that thread from 2009 revolved around a bunch of confusing and 
not so related things. And I definitely agree that `start` is a really bad name 
for this. But I don't find `default` to be at all confusing, and in fact this 
has come up in #python a few times and each time there hasn't really been a 
problem explaining to someone what `default` would do (or how it would interact 
with `key` for that matter, although if a precedent is desired, the default in 
`argparse` just returns the default, it doesn't call `type` or anything on it).

--

___
Python tracker 

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



[issue18111] Add a default argument to min & max

2013-06-01 Thread R. David Murray

R. David Murray added the comment:

So you aren't really asking for a default, you are asking for a version of 
max/min that returns a sentinel instead of raising an error on an empty list. 
You could just write utility function that has a try/except in it.  I'm not 
sure it is worth complicating min and max for this use case.  (I'm not sure it 
isn't, either.)  I wonder if we have any other functions in python that have an 
argument that turns a ValueError into a sentinel-return instead?

--

___
Python tracker 

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



[issue18111] Add a default argument to min & max

2013-06-01 Thread Julian Berman

Julian Berman added the comment:

Yes that's a good description. I'm not sure the type of exception is the thing 
to look at as much as the behavior, I.e. I think next() is a good precedent.

And it's not really pleasant to do this with a try/except. Of course 
everything's possible, but to catch the ValueError sanely requires checking the 
text of the exception so that the except isn't too broad.

--

___
Python tracker 

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



[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-01 Thread Vajrasky Kok

Vajrasky Kok added the comment:

I redo the test as Terry J. Reedy suggested. I use label in loop, utilize 
subTest receiving label parameter, and pass messages to only necessary asserts.

So roughly if the test fails, we would get something like this:

==
FAIL: test_copying (__main__.TestOrderedDict) (label='OrderedDict(od)')
--
Traceback (most recent call last):
  File "Lib/test/test_collections.py", line 1237, in test_copying
self.assertTrue(dup is not dup, msg)
AssertionError: False is not true : 
copy: OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])
od: OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])

==
FAIL: test_copying (__main__.TestCounter) (label='Counter(words)')
--
Traceback (most recent call last):
  File "Lib/test/test_collections.py", line 942, in test_copying
self.assertEqual(type(dup), type(''), msg)
AssertionError:  !=  : 
copy: Counter({'which': 2, 'witches': 1, 'witch': 1, 'watch': 1, 'wrist': 1, 
'had': 1})
words: Counter({'which': 2, 'witches': 1, 'had': 1, 'watch': 1, 'witch': 1, 
'wrist': 1})

--
Added file: http://bugs.python.org/file30443/test_with_label_and_subTest.patch

___
Python tracker 

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



[issue18116] getpass.getpass() triggers ResourceWarning

2013-06-01 Thread Vajrasky Kok

Vajrasky Kok added the comment:

This bug happens in Python 3.4 as well.

[sky@localhost cpython]$ ./python --version
Python 3.4.0a0
[sky@localhost cpython]$ ./python /tmp/bugme.py
/home/sky/Code/python/programming_language/cpython/Lib/os.py:1025: 
ResourceWarning: unclosed file <_io.FileIO name=3 mode='rb+'>
  return io.open(fd, *args, **kwargs)
What's up?

I tried to apply the patch manually (by copying, cutting and pasting) from Alex 
but Nikolaus is right. The patch does not work. The bug still happens

--
nosy: +vajrasky

___
Python tracker 

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



[issue18111] Add a default argument to min & max

2013-06-01 Thread R. David Murray

R. David Murray added the comment:

I don't think there's any other way to get a ValueError out of min/max, but I 
haven't actually looked at the code to check.  Of course, if we want people to 
rely on that, we'd need to document it.

'next's default is used to return a sentinel when the list is exhausted, not 
when it would otherwise raise a ValueError.  It is a somewhat related case, but 
is not exactly parallel.  The sentinel for next indicates the end of an ongoing 
process.  The proposed argument to min/max would *replace* an error with a 
sentinel value.

--

___
Python tracker 

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



[issue18111] Add a default argument to min & max

2013-06-01 Thread Julian Berman

Julian Berman added the comment:

It's not exactly the same of course, but calling next on a thing that might be 
empty would be somewhat close, and also is replacing an exception with a 
sentinel (an exception that is much easier to differentiate).

You can always get a ValueError out of min/max, they're going to be ultimately 
calling __lt__ on stuff which can do what it wants, but that's admittedly quite 
unlikely.

It's not really that readable though on the other hand.

--

___
Python tracker 

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