[issue20075] help(open) eats first line

2013-12-27 Thread Vajrasky Kok

Vajrasky Kok added the comment:

The patch does not fix it. It becomes like this:

open(...)
Open file and return a stream.  Raise IOError upon failure.

It's not just help(open) has problem, help(sqlite3.connect) got it as well:

connect(...)
check_same_thread, factory, cached_statements, uri])

Opens a connection to the SQLite database file *database*. You can use

--
nosy: +vajrasky

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



[issue19944] Make importlib.find_spec load packages as needed

2013-12-27 Thread Eric Snow

Eric Snow added the comment:

Any thoughts on the latest patch?

--

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



[issue20078] zipfile - ZipExtFile.read goes into 100% CPU infinite loop on maliciously binary edited zips

2013-12-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka
nosy: +serhiy.storchaka
stage:  - needs patch
versions: +Python 3.4

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



[issue20078] zipfile - ZipExtFile.read goes into 100% CPU infinite loop on maliciously binary edited zips

2013-12-27 Thread Ronald Oussoren

Changes by Ronald Oussoren ronaldousso...@mac.com:


--
nosy: +ronaldoussoren

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



[issue20079] Add support for glibc supported locales

2013-12-27 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch adds to locale alias table the mappings for locales supported in 
recent glibc (v 2.18). It also modifies the makelocalealias.py script so that 
it parses the SUPPORTED file from glibc sources and supports command line 
options for source paths.

--
components: Library (Lib)
files: locale_glibc_supported.patch
keywords: patch
messages: 206987
nosy: lemburg, loewis, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Add support for glibc supported locales
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33278/locale_glibc_supported.patch

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



[issue20079] Add support for glibc supported locales

2013-12-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Totally added 100 new mappings.

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Larry Hastings

Larry Hastings added the comment:

The best fix would be to convert the docstrings to something inspect can parse. 
 Preferably by converting the functions to use Argument Clinic, though you 
could manually mark up the docstring by hand if necessary.

--

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



[issue20080] Unused variable in Lib/sqlite3/test/factory.py

2013-12-27 Thread Vajrasky Kok

New submission from Vajrasky Kok:

There is unused variable t in Lib/sqlite3/test/factory.py.

def CheckSqliteRowAsTuple(self):
Checks if the row object can be converted to a tuple
self.con.row_factory = sqlite.Row
row = self.con.execute(select 1 as a, 2 as b).fetchone()
t = tuple(row)

def CheckSqliteRowAsDict(self):

Attached the patch to give the purpose to variable t.

--
components: Tests
files: unused_variable_in_factory_py.patch
keywords: patch
messages: 206990
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Unused variable in Lib/sqlite3/test/factory.py
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33279/unused_variable_in_factory_py.patch

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

  import io
  io.TextIOWrapper(open(/dev/tty, rb+))
 
 Traceback (most recent call last):
   File stdin, line 1, in module
 io.UnsupportedOperation: File or stream is not seekable.

buffering=0

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 The best fix would be to convert the docstrings to something inspect can
 parse.  Preferably by converting the functions to use Argument Clinic,
 though you could manually mark up the docstring by hand if necessary.

We can't check all docstrings in the stdlib and in all third-party libraries.

--

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



[issue9351] argparse set_defaults on subcommands should override top level set_defaults

2013-12-27 Thread Mikael Knutsson

Mikael Knutsson added the comment:

Just wanted to drop in here to let you know that I hit this behaviour recently 
when writing a small tool using both configparser and argparse and the 
workaround proves rather annoying (custom namespace object or similar).

Would be awesome if this moved forward with the proposed patch!

--
nosy: +mikn

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

Yes, so basically signature line in help(open) is not shown because ast.parse 
fails to parse the return value

- file object

According to grammar, it should be 
- file 
or 
- 'file object' 
or something like this.

as for sqlite, it fails to parse square brackets:

connect(database[, timeout, detect_types, isolation_level,\n\
check_same_thread, factory, cached_statements, uri])

As an idea, maybe we can come up with a failover i.e. if ast can't parse the 
signature, just use __text_signature__ instead of signature object:

Lib/pydoc.py:1325
if not argspec:
-   argspec = '(...)'
+   argspec = object.__text_signature__


Or probably just don't show the signature if it is not formatted correctly as 
it is now (after the patch applied).

--

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



[issue19944] Make importlib.find_spec load packages as needed

2013-12-27 Thread Nick Coghlan

Nick Coghlan added the comment:

The simple patch actually looks like a good way to end up with find_spec 
specific bugs because it diverges from the more thoroughly tested main import 
path (e.g. it looks to me like it doesn't release the import lock properly)

So the _FoundSpec version actually looks better to me, because it keeps 
find_spec more inline with actual imports.

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Zachary Ware

Zachary Ware added the comment:

The patch looks good to me (aside from extra whitespace on the blank lines in 
methodobject.c, and I agree with Serhiy about s/brackets/parens/).  Also, I 
like the suggestion of using __text_signature__ instead of '(...)'.  However, 
just to avoid any possible issues with __text_signature__ being blank or 
missing, I would go with `argspec = getattr(object, '__text_signature__', '') 
or '(...)'` instead of straight `object.__text_signature__` (and note that 
there are two places to change in pydoc).

--

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



[issue20080] Unused variable in Lib/sqlite3/test/factory.py

2013-12-27 Thread Eric V. Smith

Eric V. Smith added the comment:

I think you want to either also testing the number of elements in t, or in just 
compare t to (row[a], row[b]) (untested).

--
nosy: +eric.smith

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Dolda2000

Dolda2000 added the comment:

Oh sorry, my bad. I messed up. :)

Given that that works, though, why can't open() handle opening /dev/tty 
directly in text mode? Clearly, TextIOWrapper can handle the necessary 
buffering without the stream having to be seekable.

--

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



[issue17484] add tests for getpass

2013-12-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 100f632d4306 by R David Murray in branch '3.3':
#18116: backport fix to 3.3 since real-world failure mode demonstrated.
http://hg.python.org/cpython/rev/100f632d4306

--

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 100f632d4306 by R David Murray in branch '3.3':
#18116: backport fix to 3.3 since real-world failure mode demonstrated.
http://hg.python.org/cpython/rev/100f632d4306

--
nosy: +python-dev

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



[issue18116] getpass.unix_getpass() always fallback to sys.stdin

2013-12-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 100f632d4306 by R David Murray in branch '3.3':
#18116: backport fix to 3.3 since real-world failure mode demonstrated.
http://hg.python.org/cpython/rev/100f632d4306

New changeset 29a5a5b39dd6 by R David Murray in branch 'default':
Mostly-null merge of #18116 backport (updated NEWS entry).
http://hg.python.org/cpython/rev/29a5a5b39dd6

--

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread R. David Murray

R. David Murray added the comment:

Having buffering doesn't make the stream seekable.  So the question is, is the 
*design* of the IO module that '+' requires a seekable stream the best 
behavior, or can that constraint be relaxed?  You have to keep in mind that the 
IO module is a bunch of building blocks, which are plugged together 
automatically for the most common scenarios.  The goal is a portable, 
consistent IO system, not one that completely mimics unix/C IO primitives.

--

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Having buffering doesn't make the stream seekable.  So the question
 is, is the *design* of the IO module that '+' requires a seekable
 stream the best behavior, or can that constraint be relaxed?

A non-seekable read/write stream doesn't really make sense (think about
it).
What you may be thinking about, instead, is a pair of non-seekable
streams, one readable and one writable. There is BufferedRWPair for
that:
http://docs.python.org/dev/library/io.html#io.BufferedRWPair

(granted, BufferedRWPair isn't wired in open(), so you have to do all
the wrapping yourself)

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

Thank you for the comments! I'll update the patch.


BTW is it safe to update Lib/inspect.py:2004 ?

- return cls(parameters, return_annotation=cls.empty)
+ return cls(parameters, return_annotation=f.returns.s or cls.empty)

Looks like the return value is not shown in signature (if it parsed correctly) 
because currently we explicitly pass cls.empty instance, but if we'd pass 
f.returns.s, the return value is shown.

Or it is correct behavior?

--

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



[issue20081] sys.getwindowsversion does nto show some fields

2013-12-27 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola':

On Windows 7:

 v = sys.getwindowsversion()
 v
sys.getwindowsversion(major=6, minor=1, build=7600, platform=2, service_pack='')
 v.service_pack_major
0
 v.service_pack_minor
0
 v.suite_mask
254

Doc states:

 For compatibility with prior versions, only the first 5 elements are 
 retrievable by indexing.

...so I guess that's why service_pack_minor, service_pack_major and suite_mask 
fields are not shown.
Nevertheless I think this is a inconvenience which should be fixed, at least in 
the next major Python version.

--
messages: 207005
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: sys.getwindowsversion does nto show some fields
versions: Python 3.4, Python 3.5

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



[issue20081] sys.getwindowsversion does not show some fields

2013-12-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
title: sys.getwindowsversion does nto show some fields - sys.getwindowsversion 
does not show some fields

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



[issue20059] Inconsistent urlparse/urllib.parse handling of invalid port values?

2013-12-27 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue20050] distutils should check PyPI certs when connecting to it

2013-12-27 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue20078] zipfile - ZipExtFile.read goes into 100% CPU infinite loop on maliciously binary edited zips

2013-12-27 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue20081] sys.getwindowsversion does not show some fields

2013-12-27 Thread R. David Murray

R. David Murray added the comment:

This is essentially a duplicate of item (3) in issue 1820, although I'm not 
entirely clear on what the repr would actually look like.

--
nosy: +r.david.murray

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

So, looks like it works for me and all tests pass.
Here's a new patch.
Feel free to revert Lib/inspect.py:2004-2009 if this is incorrect behavior.

--
Added file: http://bugs.python.org/file33280/20075-2.patch

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



[issue20075] help(open) eats first line

2013-12-27 Thread Larry Hastings

Larry Hastings added the comment:

One of the relevant PEPs (PEP 8?  PEP 7?  the annotations PEP?) states that the 
Python standard library is not permitted to use annotations.  And considering 
that Argument Clinic is an internal-only tool, we could probably justify the 
decision to not allow annotations to creep through.

That said, I think it's harmless, and it might be useful to somebody, so go 
ahead and propagate the annotation from the __text_signature__ into 
inspect.Signature if we get a valid one.  But please create a separate issue 
for it.  (I encourage you to cut-and-paste this text into the description of 
that new issue.)

--

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



[issue1565525] tracebacks eat up memory by holding references to locals and globals when they are not wanted

2013-12-27 Thread A.M. Kuchling

Changes by A.M. Kuchling a...@amk.ca:


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

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



[issue20062] Add section on vim to devguide

2013-12-27 Thread Tshepang Lekhonkhobe

Tshepang Lekhonkhobe added the comment:

I think there should not be any section about any editor in the devguide. It's 
beyond scope, and it risks going stale.

--
nosy: +tshepang

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Dolda2000

Dolda2000 added the comment:

So the question is, is the *design* of the IO module that '+' requires a 
seekable stream the best behavior, or can that constraint be relaxed?

What purpose does that constraint serve? Is there any reason it shouldn't be 
relaxed?

It seems to work quite well without it in Python 2.

--

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



[issue20042] Python Launcher, Windows, fails on scripts w/ non-latin names

2013-12-27 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
title: Python Launcher for Windows fails to invoke scripts with non-latin names 
- Python Launcher, Windows, fails on scripts w/ non-latin names

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



[issue20062] Add section on vim to devguide

2013-12-27 Thread R. David Murray

R. David Murray added the comment:

We have pointers to external resources all over the docs.  Yes, they go stale 
sometimes, and when somebody notices, we update them.  What do you use for 
development is a common topic of discussion, so I don't see any reason not to 
include some pointers in the devguide.  (Not tutorials, just pointers to 
resources.)

--

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread R. David Murray

R. David Murray added the comment:

Antoine already answered that question: it does not make sense to have a single 
stream that is open for *update* if it is not seekable.  The fact C conflates 
update with both read and write can be seen as a design bug in C :)
 
The remaining question might be: is there a sensible way (that fits with the 
design of the IO system) to hook BufferedRWPair up to open?

--

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



[issue20077] Format of TypeError differs between comparison and arithmetic operators

2013-12-27 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
components: +Interpreter Core -ctypes
nosy: +ncoghlan
versions: +Python 3.5 -Python 3.3, Python 3.4

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



[issue20077] Format of TypeError differs between comparison and arithmetic operators

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

I created a patch for it, please review

--
keywords: +patch
nosy: +gennad
Added file: http://bugs.python.org/file33281/20077.patch

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

I'm sorry, I'm not sure I caught the idea. So, I need to create an issue with 
description

propagate the annotation from the __text_signature__ into inspect.Signature if 
we get a valid one. ?

--

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



[issue20082] Misbehavior of BufferedRandom.write with raw file in append mode

2013-12-27 Thread Erik Bray

New submission from Erik Bray:

In #18876 I pointed out the following issue:

BufferedWriter/Random doesn't know the raw file was opened with O_APPEND so the 
writes it shows in the buffer differ from what will actually end up in the 
file.  For example:

 f = open('test', 'wb')
 f.write(b'testest')
7
 f.close()
 f = open('test', 'ab+')
 f.tell()
7
 f.write(b'A')
1
 f.seek(0)
0
 f.read()
b'testestA'
 f.seek(0)
0
 f.read(1)
b't'
 f.write(b'B')
1
 f.seek(0)
0
 f.read()
b'tBstestA'
 f.flush()
 f.seek(0)
0
 f.read()
b'testestAB'

In this example, I read 1 byte from the beginning of the file, then write one 
byte.  Because of O_APPEND, the effect of the write() call on the raw file is 
to append, regardless of where BufferedWriter seeks it to first.  But before 
the f.flush() call f.read() just shows what's in the buffer which is not what 
will actually be written to the file.  (Naturally, unbuffered io does not have 
this particular problem.)


Now that #18876 we can test if a file was opened in append mode and correct for 
this.  The attach patch includes a pretty simple solution that manually calls 
buffered_seek at the beginning of bufferedwriter_write if the raw file is in 
append mode.  In doing so it made sense to split buffered_seek into two 
separate functions.

This might be overkill, however.

--
components: IO
files: buffered-append-1.patch
keywords: patch
messages: 207015
nosy: erik.bray
priority: normal
severity: normal
status: open
title: Misbehavior of BufferedRandom.write with raw file in append mode
type: behavior
Added file: http://bugs.python.org/file33282/buffered-append-1.patch

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



[issue20062] Add section on vim to devguide

2013-12-27 Thread Ezio Melotti

Ezio Melotti added the comment:

I don't think the devguide is a good place for this unless some editors support 
features that are particularly interesting for CPython development (e.g. 
something to check refleaks).
If the features are generic enough that any Python programmer would find them 
interesting, something could be said in the Python FAQs [0] or the wiki [1].  
The FAQs already mention this briefly and have a link to the wiki.

[0]: http://docs.python.org/3/faq/general.html
[1]: https://wiki.python.org/moin/PythonEditors

--
nosy: +pitrou

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



[issue20083] smtplib: support for IDN (international domain names)

2013-12-27 Thread Freek Dijkstra

New submission from Freek Dijkstra:

smtplib has limited support for non-ASCII domain names in the From to To mail 
address. It only works for punycode-encoded domain names, submitted as unicode 
string (e.g. server.rcpt(uu...@xn--e1afmkfd.ru).

The following two calls fail:

server.rcpt(uuser@пример.ru):
  File smtplib.py, line 332, in send
s = s.encode(ascii)
UnicodeEncodeError: 'ascii' codec can't encode character '\u03c0' in position 
19: ordinal not in range(128)
http://hg.python.org/cpython/file/3.3/Lib/smtplib.py#l332

server.rcpt(bu...@xn--e1afmkfd.ru):
  File email/_parseaddr.py, line 236, in gotonext
if self.field[self.pos] in self.LWS + '\n\r':
TypeError: 'in string' requires string as left operand, not int
http://hg.python.org/cpython/file/3.3/Lib/email/_parseaddr.py#l236

There are three ways to solve this (from trivial to complex):
* Make it clear in the documentation what type of input is expected.
* Accept punycode-encoded domain names in email addresses, either in string or 
binary format.
* Accept Unicode-encoded domain names, and do the punycode encoding in the 
smtplib if required.

See also 

References:
https://tools.ietf.org/html/rfc5891: Internationalized Domain Names in 
Applications (IDNA): Protocol

--
components: Library (Lib)
messages: 207017
nosy: macfreek
priority: normal
severity: normal
status: open
title: smtplib: support for IDN (international domain names)
type: enhancement

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



[issue20084] smtplib: support for UTF-8 encoded headers (SMTPUTF8)

2013-12-27 Thread Freek Dijkstra

New submission from Freek Dijkstra:

smtplib has no support for non-ASCII user names in the From to To mail address.

The following two calls fail:

server.rcpt(uόνομα@example.com):
  File smtplib.py, line 332, in send
s = s.encode(ascii)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: 
ordinal not in range(128)
http://hg.python.org/cpython/file/3.3/Lib/smtplib.py#l332

server.rcpt(b'\xcf\x8c\xce\xbd\xce\xbf\xce\xbc\xce\x...@example.com'):
  File email/_parseaddr.py, line 236, in gotonext
if self.field[self.pos] in self.LWS + '\n\r':
TypeError: 'in string' requires string as left operand, not int
http://hg.python.org/cpython/file/3.3/Lib/email/_parseaddr.py#l236

There are two ways to solve this:
* Allow users of smptlib to support internationalised email by passing already 
encoded headers and email addresses. The users is responsible for the encoding 
and setting the SMTPUTF8 ESMTP option.
* Accept Unicode-encoded email addresses, and convert that to UTF-8 in the 
library. smtplib is responsible for the encoding and setting the SMTPUTF8 ESMTP 
option.

References:
https://tools.ietf.org/html/rfc6531: SMTP Extension for Internationalized Email

See also Issue20083, which deals with international domain names in email 
addresses (the part behind the @). This issue deals with the part before the 
@.

Note that this is different from RFC 2047, which merely allows non-ASCII 
encoding in text values in the headers (such as the name of a recipient or the 
mail subject).

--
components: Library (Lib)
messages: 207018
nosy: macfreek
priority: normal
severity: normal
status: open
title: smtplib: support for UTF-8 encoded headers (SMTPUTF8)
type: enhancement

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



[issue20083] smtplib: support for IDN (international domain names)

2013-12-27 Thread Freek Dijkstra

Freek Dijkstra added the comment:

This issue deals with international domain names in email addresses (the part 
behind the @). See issue 20084 for the issue that deals with the part before 
the @.

--

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



[issue4492] httplib code thinks it closes connection, but does not

2013-12-27 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue7464] circular reference in HTTPResponse by urllib2

2013-12-27 Thread Martin Panter

Martin Panter added the comment:

Sounds like urlopen() is relying on garbage collection to close the socket and 
connection. Maybe it would be better to explicitly close the socket, even if 
you do eliminate all the garbage reference cycles.

My test code for Issue 19524 might be useful here. It verifies close() has been 
called on the HTTP socket.

--
nosy: +vadmium

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



[issue20085] Python2.7, wxPython and IDLE 2.7

2013-12-27 Thread stubz

New submission from stubz:

I new to this so I have no idea what's going on ...
I'm using Mint 16 Cinnamon and apparently Python 2.7+ 3.3 are installed
I started puttering with wxPython 2.8 and I have issues ...

I started a tutorial, saved some work.py and got things to run, I guess ...

When I try to open and edit a work.py file I get a blank window ... ?

I also lose my number pad, auto indents and can't close that blank window, I 
basically have to show down the computer to get it to go away ...

I don't know if this is Mint, Python, IDLE or me, but it's annoying ...

Can anyone giving me an idea as to what's going on ?

--
messages: 207021
nosy: stubz
priority: normal
severity: normal
status: open
title: Python2.7, wxPython and IDLE 2.7
type: behavior

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



[issue20059] Inconsistent urlparse/urllib.parse handling of invalid port values?

2013-12-27 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue20074] open() of read-write non-seekable streams broken

2013-12-27 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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