[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2014-06-14 Thread Steve Dower

Steve Dower added the comment:

It's actually bad code generation for the switch statement in 
build_filter_spec() in _lzmamodule.c.

I've filed a bug, so hopefully it will be fixed, but if not then it should be 
easy enough to exclude that function (or even the whole module - _lzmamodule.c 
doesn't have any of the speed critical parts in it, by the look of it).

--

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



[issue21754] Add tests for turtle.TurtleScreenBase

2014-06-14 Thread ingrid

Changes by ingrid h...@ingridcheung.com:


--
components: Tests
files: TurtleScreenBase_tests.patch
keywords: patch
nosy: ingrid, jesstess
priority: normal
severity: normal
status: open
title: Add tests for turtle.TurtleScreenBase
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file35624/TurtleScreenBase_tests.patch

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



[issue21694] IDLE - Test ParenMatch

2014-06-14 Thread Tal Einat

Tal Einat added the comment:

ParenMatch is indeed failing when the cursor is after the first parenthesis of 
the following code:

(3 +
 4 - 1)

This happens both in Shell and Editor windows.

I've traced the problem down to HyperParser. It doesn't properly support 
multi-line statements, as can be seen by the following line in 
HyperParser.__init__():

stopatindex = %d.end % lno

(this appears twice, once in each branch of the same if statement)

Fixing this requires looking forward a few lines to find the end of the 
statement. I'm continuing to look through the code to try to find an efficient 
way to do this (without parsing the entire file).

--

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



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2014-06-14 Thread Aymeric Augustin

Aymeric Augustin added the comment:

 The idea was to not take away from what's there already: The sqlite3 module 
 already has a feature to inspect a command and begin or commit automatically. 
 Just stripping that away *removes* a feature that has been available for a 
 long time. I'd rather give the
client more control instead of less and let him fine tune this behaviour.

For the sake of clarity, I haven't proposed to remove anything. I'm focusing on 
preserving the same behavior by default (with its advantages and drawbacks) and 
providing more control for users who need a different behavior, for instance 
people who use SQLite as an application file format or as a web application 
storage backend.


 When starting with Python I always thought that code like this is harmles:

 conn = sqlite3.connect(test.db)
 data = list(conn.execute(select * from mytable))

 Currently it is, but only because sqlite3 module parses the select as DQL and 
 does not lock the database.

It will absolutely remain harmless with my proposal, if you don't change your 
code.

However, for that use case I would like to encourage the use of autocommit 
mode. That's really the semantics you want here.


In fact, you've written several sentences along the lines currently we have 
$ADVANTAGE. It's easy to (mis)interpret that as implying that I'm trying to 
remove these advantages. But that's simply not true.


To sum up, if I understand correctly, in_transaction gives you the ability to 
fight the behavior mandated by the DB API in client code, because you 
understand it well.

My take is to avoid the problem entirely, and not inflict it to new users, by 
providing an option to start in autocommit mode and then create transactions 
only when you want them.

The DB API doesn't forbid this option. It just prevents it from being the 
default (even though it's what the average developer expects).

It solves the problem of using SQLite as an application file format. Use 
autocommit as long as you're just reading; start a transaction before writing; 
commit when you're done writing.

Of course, that only applies to new software. Existing software can happily 
keep using the current behavior, which will be preserved at least for the 
lifetime of Python 3.

--

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



[issue21755] test_importlib.test_locks fails --without-threads

2014-06-14 Thread Berker Peksag

New submission from Berker Peksag:

==
ERROR: test.test_importlib.test_locks (unittest.loader.ModuleImportFailure)
--
Traceback (most recent call last):
  File /home/berker/projects/cpython-default/Lib/unittest/case.py, line 58, 
in testPartExecutor
yield
  File /home/berker/projects/cpython-default/Lib/unittest/case.py, line 577, 
in run
testMethod()
  File /home/berker/projects/cpython-default/Lib/unittest/loader.py, line 32, 
in testFailure
raise exception
ImportError: Failed to import test module: test.test_importlib.test_locks
Traceback (most recent call last):
  File /home/berker/projects/cpython-default/Lib/unittest/loader.py, line 
312, in _find_tests
module = self._get_module_from_name(name)
  File /home/berker/projects/cpython-default/Lib/unittest/loader.py, line 
290, in _get_module_from_name
__import__(name)
  File 
/home/berker/projects/cpython-default/Lib/test/test_importlib/test_locks.py, 
line 123, in module
DeadlockError=DEADLOCK_ERRORS)
  File /home/berker/projects/cpython-default/Lib/test/test_importlib/util.py, 
line 82, in test_both
return split_frozen(test_class, base, **kwargs)
  File /home/berker/projects/cpython-default/Lib/test/test_importlib/util.py, 
line 76, in split_frozen
frozen = specialize_class(cls, 'Frozen', base, **kwargs)
  File /home/berker/projects/cpython-default/Lib/test/test_importlib/util.py, 
line 70, in specialize_class
value = values[kind]
KeyError: 'Frozen'

I've used the same logic as ModuleLockAsRLockTests to silence the test failure.

Patch attached.

--
components: Tests
files: test_locks.diff
keywords: patch
messages: 220534
nosy: berker.peksag, brett.cannon, eric.snow
priority: normal
severity: normal
stage: patch review
status: open
title: test_importlib.test_locks fails --without-threads
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35625/test_locks.diff

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



[issue21752] Document Backwards Incompatible change to logging in 3.4

2014-06-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 277d099a134b by Vinay Sajip in branch '3.4':
Issue #21752: Documented change to behaviour of logging.getLevelName().
http://hg.python.org/cpython/rev/277d099a134b

New changeset 174c30103b57 by Vinay Sajip in branch 'default':
Closes #21752: Merged update from 3.4.
http://hg.python.org/cpython/rev/174c30103b57

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue21694] IDLE - Test ParenMatch

2014-06-14 Thread Tal Einat

Tal Einat added the comment:

Progress: As a hack for exploring this issue, I fixed this in the Shell window 
by having ParenMatch instantiate HyperParser in such a way that it parses the 
entirety of the current input. In ParenMatch.flash_paren_event(), I added:

from idlelib.PyShell import PyShell
if isinstance(self.editwin, PyShell):
hp = HyperParser(self.editwin, end-1c)
hp.set_index(insert)
indices = hp.get_surrounding_brackets()
else:
current behavior

With this the given example works as expected in the Shell window, i.e. the 
entire expression is highlighted when the cursor is after the first bracket and 
pressing ^0.

I still need to find a less hackish way to do this which will also work for 
editor windows.

--

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



[issue21748] glob.glob does not sort its results

2014-06-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Actually iglob() can sort (per directory). But I don't think this is too needed 
feature. In any case you can sort result of glob().

--
nosy: +serhiy.storchaka

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



[issue21751] Expand zipimport to support bzip2 and lzma

2014-06-14 Thread Serhiy Storchaka

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


--
resolution:  - duplicate
status: open - closed
superseder:  - Expand zipimport to include other compression methods

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



[issue21751] Expand zipimport to support bzip2 and lzma

2014-06-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As shown in msg180323, using lzma compression for typical *.py and *.pyc 
produces 8% less zip file, but reading from it is 2.5 times slower. The bzip2 
compression is even worse. So there is no large benefit in supporting other 
compression methods.

--
nosy: +serhiy.storchaka

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



[issue21652] Python 2.7.7 regression in mimetypes module on Windows

2014-06-14 Thread Vladimir Iofik

Vladimir Iofik added the comment:

Thanks, Martin. I didn't read the final with enough care. I think the second 
part of changes (the ones that are around QueryValueEx) should be rolled back. 
I believe the code was correct at that part.
Tim, what do you think?

--

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



[issue21742] WatchedFileHandler can fail due to race conditions or file open issues.

2014-06-14 Thread Vinay Sajip

Vinay Sajip added the comment:

There *is* a race condition with WatchedFileHandler - see #14632 - but there is 
not much that can be done about it (see the various comments in that issue). 
BTW, I wasn't able to reproduce the threading problem from your script: there 
were no errors and the file 'foo' contained three lines with 'foo', as expected.

Your suggested fix doesn't seem right, either - the problem is that a failed 
_open() leaves a closed stream in self.stream, and the correct fix is to set 
this to None in case the _open fails. But thanks for the suggestion.

--
versions:  -Python 3.1, Python 3.2, Python 3.3

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



[issue13322] buffered read() and write() does not raise BlockingIOError

2014-06-14 Thread Martin Panter

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


--
nosy: +vadmium
versions: +Python 3.4

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



[issue21742] WatchedFileHandler can fail due to race conditions or file open issues.

2014-06-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bb8b0c7fefd0 by Vinay Sajip in branch '2.7':
Issue #21742: Set stream to None after closing.
http://hg.python.org/cpython/rev/bb8b0c7fefd0

New changeset 6f1f38775991 by Vinay Sajip in branch '3.4':
Issue #21742: Set stream to None after closing.
http://hg.python.org/cpython/rev/6f1f38775991

New changeset 9913ab26ca6f by Vinay Sajip in branch 'default':
Closes #21742: Merged fix from 3.4.
http://hg.python.org/cpython/rev/9913ab26ca6f

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue21756] IDLE - ParenMatch fails to find closing paren of multi-line statements

2014-06-14 Thread Tal Einat

Changes by Tal Einat talei...@gmail.com:


--
type:  - behavior

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



[issue21756] IDLE - ParenMatch fails to find closing paren of multi-line statements

2014-06-14 Thread Tal Einat

New submission from Tal Einat:

Originally reported on issue #21694.

Regarding, for example, the following code:
(3  +
 4 -   1)

Placing the cursor after the opening parenthesis and invoking the Show 
surrounding parens event causes just the first line to be highlighted. 
Obviously, the second line should be highlighted as well.

I've found a good (clean  fast) solution for shell windows, but can't find any 
good way for editor windows other than always parsing the entire code. Doing 
this every time HyperParser is used could significantly degrade IDLE's 
performance. Therefore I've decided to have this done only by 
ParenMatch.flash_paren_event(). Note that ParenMatch.paren_closed_event() 
doesn't need this, since all of the code which is relevant for inspection lies 
before the closing parenthesis.

See attached patch fixing this issue. Review and additional testing are 
required.

--
components: IDLE
files: taleinat.20140614.IDLE_parenmatch_multiline_statement.patch
keywords: patch
messages: 220542
nosy: taleinat, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE - ParenMatch fails to find closing paren of multi-line statements
versions: Python 2.7, Python 3.4, Python 3.5
Added file: 
http://bugs.python.org/file35626/taleinat.20140614.IDLE_parenmatch_multiline_statement.patch

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



[issue21694] IDLE - Test ParenMatch

2014-06-14 Thread Tal Einat

Tal Einat added the comment:

I've opened a separate issue for the issue raised by Terry, #21756. Patch is 
included there.

--
Added file: 
http://bugs.python.org/file35627/taleinat.20140614.IDLE_parenmatch_multiline_statement.patch

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



[issue21694] IDLE - Test ParenMatch

2014-06-14 Thread Tal Einat

Changes by Tal Einat talei...@gmail.com:


Removed file: 
http://bugs.python.org/file35627/taleinat.20140614.IDLE_parenmatch_multiline_statement.patch

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



[issue11287] Add context manager support to dbm modules

2014-06-14 Thread Claudiu Popa

Claudiu Popa added the comment:

Hi. This was already fixed in c2f1bb56760d. I'm sorry that this patch didn't 
make it through.

--
nosy: +Claudiu.Popa
resolution:  - fixed
stage: needs patch - resolved
status: open - closed

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2014-06-14 Thread Stefan Krah

Stefan Krah added the comment:

Isn't PyLong_FromUnsignedLongLong() still involved through spec_add_field()?

--

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



[issue19495] Enhancement for timeit: measure time to run blocks of code using 'with'

2014-06-14 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

 It might still be worth having a time elapsed decorator

This is exactly what I think. It's a very common task.

--

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



[issue21724] resetwarnings doesn't reset warnings registry

2014-06-14 Thread Stefan van der Walt

Stefan van der Walt added the comment:

This can be quite painful to work around, since the warning registry is 
scattered all over.  See, e.g.,

https://github.com/scikit-image/scikit-image/blob/master/skimage/_shared/_warnings.py#L9

--
nosy: +stefanv

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



[issue21686] IDLE - Test hyperparser

2014-06-14 Thread Tal Einat

Tal Einat added the comment:

Here are details how to trigger all of the uncovered code lines and branches, 
listed by line.


Uncovered lines:

Line 159: This catches would-be identifiers (variable names) which are keywords 
or begin with a character that can't be first (e.g. a digit). We should have at 
least one test for each of these cases.

Lines 196-198: These strip comments from inside an expression. We should have a 
test with sample code with a multi-line expression with a comment inside it.

Line 225: Triggered when trying to find an expression including parentheses or 
brackets when they aren't closed, e.g. [x for x in .


Uncovered branches (except those which just cause the above):

Lines 32, 42: To trigger, have a block of code over 50 lines long and create a 
HyperParser at the last line (not inside any other block).

Line 236: Have a string literal inside brackets or parens, and call 
get_expression().

--

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



[issue21686] IDLE - Test hyperparser

2014-06-14 Thread Tal Einat

Tal Einat added the comment:

Regarding lines 32  42, a test could also set editwin.num_context_lines to 
allow triggering with smaller code blocks. It's value needs to be a list of 
integers, the last of which is incredibly large, perhaps sys.maxint.

--

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



[issue12617] Mutable Sequence Type can work not only with iterable in slice[i:j] = t

2014-06-14 Thread Claudiu Popa

Claudiu Popa added the comment:

This was fixed in the latest versions.

 b = bytearray(b'457')
 b[:1] = 4
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: can assign only bytes, buffers, or iterables of ints in range(0, 256)


--
nosy: +Claudiu.Popa
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2014-06-14 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Please don't. If the compiler is demonstrated to generate bad code in one case, 
we should *not* exclude that code from optimization, but not use optimization 
at all. How many other places will there be which also cause bad code being 
generated that just happens not to be uncovered by the test suite?

--

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



[issue21684] inspect.signature bind doesn't include defaults or empty tuple/dicts

2014-06-14 Thread Ryan McCampbell

Ryan McCampbell added the comment:

If this is decided against, a partial solution would be to set the default 
attribute of VAR_POSITIONAL and VAR_KEYWORD args to an empty tuple/dict, 
respectively. Then you could get a parameter's value no matter what with 
boundargs.get(param.name, param.default).

--

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



[issue21757] Can't reenable menus in Tkinter on Mac

2014-06-14 Thread Mark Bell

New submission from Mark Bell:

The following example is a Tkinter app with a button that toggles the menu 
being enabled based off of 
https://mail.python.org/pipermail/tkinter-discuss/2004-September/000204.html

#---

from Tkinter import *

root=Tk()

def hello():
print('hello!')

def toggle():
print('I think the menu bar is %s' % menubar.entrycget(0, 'state'))
if menubar.entrycget(0, 'state')=='normal':
print('disabling')
menubar.entryconfig(0,state=DISABLED)
print('disbled')
else:
print('enabling')
menubar.entryconfig(0,state=NORMAL)
print('enabled')

menubar = Menu(root)
submenu = Menu(menubar, tearoff=0)
submenu.add_command(label='Hello', command=hello)
menubar.add_cascade(label='test', menu=submenu)

# this cascade will have index 0 in submenu
b = Button(root, text='Toggle', command=toggle)
b.pack()

# display the menu
root.config(menu=menubar)
root.mainloop()

#---

On Windows 7 and Ubuntu 14.04 (using Python 2.7.6 and Tkinter Revision 81008) 
clicking the button toggles the menu being enabled. However, on Mac 10.9 (again 
under Python 2.7.6 and Tkinter Revision 81008) the menu becomes stuck disabled. 

Additionally, the example also prints out what state it thinks the menu has 
(using entrycget) and it would print out that it thought that the menu was in 
fact alternating between enabled and disabled.

Others have verified this being the case. See: 
http://stackoverflow.com/questions/24207870/cant-reenable-menus-in-python-tkinter-on-mac

--
components: Tkinter
files: tkinter_test.py
messages: 220553
nosy: Mark.Bell
priority: normal
severity: normal
status: open
title: Can't reenable menus in Tkinter on Mac
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file35628/tkinter_test.py

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



[issue21757] Can't reenable menus in Tkinter on Mac

2014-06-14 Thread R. David Murray

R. David Murray added the comment:

Given the description it sounds likely that this is a tk bug.

--
assignee:  - ronaldoussoren
components: +Macintosh
nosy: +r.david.murray, ronaldoussoren

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



[issue21757] Can't reenable menus in Tkinter on Mac

2014-06-14 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +ned.deily

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



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2014-06-14 Thread R. David Murray

R. David Murray added the comment:

 My take is to avoid the problem entirely, and not inflict it to new users, by 
 providing an option to start in autocommit mode and then create transactions 
 only when you want them.

If this statement is accurate, the what you are proposing is just a different 
(presumably clearer) spelling for 'isolation_level = None'?

I also don't understand why we don't just fix the screwy behavior with regards 
to savepoint.  It's hard to see how fixing that could be a backward 
compatibility problem (in a feature release), since you can't use savepoints 
without isolation_level=None as it stands now.

--

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



[issue21694] IDLE - Test ParenMatch

2014-06-14 Thread Saimadhav Heblikar

Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com:


Added file: http://bugs.python.org/file35629/test-hyperparser-v1.diff

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



[issue21694] IDLE - Test ParenMatch

2014-06-14 Thread Saimadhav Heblikar

Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com:


Removed file: http://bugs.python.org/file35629/test-hyperparser-v1.diff

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



[issue21686] IDLE - Test hyperparser

2014-06-14 Thread Saimadhav Heblikar

Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com:


Added file: http://bugs.python.org/file35630/test-hyperparser-v1.diff

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



[issue21650] add json.tool option to avoid alphabetic sort of fields

2014-06-14 Thread Berker Peksag

Berker Peksag added the comment:

Updated patch attached based on feedback from David. Thanks!

--
stage: needs patch - patch review
Added file: http://bugs.python.org/file35631/issue21650_v2.diff

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2014-06-14 Thread Steve Dower

Steve Dower added the comment:

 Isn't PyLong_FromUnsignedLongLong() still involved through spec_add_field()?

The two issues were unrelated - the 'invalid filter ID' (4611686018427387905 == 
0x4000_0001) is the correct value but the wrong branch in the switch 
was taken, leading to the error message.

 If the compiler is demonstrated to generate bad code in one case, we should 
 *not* exclude that code from optimization, but not use optimization at all.

By that logic, we should be using a debug build on every platform... I've 
encountered various codegen bugs in gcc and MSVC, though they've all been fixed 
(apart from this one). All developers are human, including most compiler 
writers.

That said, I'll wait on the response from the PGO team. If they don't give me 
enough confidence, then I'll happily forget about the whole idea of using it 
for 3.5.

--

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



[issue6916] Remove deprecated items from asynchat

2014-06-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 42a645d74e9d by Giampaolo Rodola' in branch 'default':
fix issue #6916: undocument deprecated asynchat.fifo class.q
http://hg.python.org/cpython/rev/42a645d74e9d

--
nosy: +python-dev

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



[issue6916] Remove deprecated items from asynchat

2014-06-14 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

I simply removed asynchat.fifo documentation. Closing this out.

--
resolution:  - fixed
status: open - closed
versions: +Python 3.5 -Python 3.2

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2014-06-14 Thread Claudiu Popa

Claudiu Popa added the comment:

This seems to be a reasonable fix. Michael, could you have a look at this 
patch, please?

--
nosy: +Claudiu.Popa
versions: +Python 3.5 -Python 3.2, Python 3.3, Python 3.4

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



[issue12317] inspect.getabsfile() is not documented

2014-06-14 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
assignee: giampaolo.rodola - 

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



[issue10084] SSL support for asyncore

2014-06-14 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

asyncore module has been deprecated as per 
https://docs.python.org/3/library/asyncore.html:

This module exists for backwards compatibility only. For new code we 
recommend using asyncio.

Closing this out as won't fix.

--
resolution:  - wont fix
status: open - closed

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



[issue11792] asyncore module print to stdout

2014-06-14 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

Looking back at this: a warning seems a bit too invasive to me as there are 
cases where avoiding to override a certain methods are legitimate.
I will just close this out as won't fix, also because asyncore has been 
deprecated by asyncio.

--
resolution:  - wont fix
stage: needs patch - 
status: open - closed

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



[issue21719] Returning Windows file attribute information via os.stat()

2014-06-14 Thread Ben Hoyt

Ben Hoyt added the comment:

Uploading a (hopefully final! :-) patch to fix Zach Ware's points from the code 
review:

1) use stat.FILE_ATTRIBUTE_DIRECTORY constant in test_os.py
2) break line length in stat.rst doc source

--
Added file: http://bugs.python.org/file35632/issue21719-4.patch

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



[issue18108] shutil.chown should support dir_fd and follow_symlinks keyword arguments

2014-06-14 Thread Berker Peksag

Berker Peksag added the comment:

Here's a patch.

--
keywords: +patch
nosy: +berker.peksag
stage: needs patch - patch review
Added file: http://bugs.python.org/file35633/issue18108.diff

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



[issue18108] shutil.chown should support dir_fd and follow_symlinks keyword arguments

2014-06-14 Thread Claudiu Popa

Claudiu Popa added the comment:

Looks good to me. But aren't the last two lines skipped if an error is raised 
by the first line from the with block?

+with self.assertRaises(FileNotFoundError):
+shutil.chown('invalid-file', user=uid, dir_fd=dirfd)
+shutil.chown('invalid-file', group=gid, dir_fd=dirfd)
+shutil.chown('invalid-file', user=uid, group=gid, dir_fd=dirfd)

--

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



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2014-06-14 Thread Aymeric Augustin

Aymeric Augustin added the comment:

 If this statement is accurate, the what you are proposing is just a different 
 (presumably clearer) spelling for 'isolation_level = None'?

This statement is accurate but it doesn't cover the whole scope of what I'm 
attempting to fix.

I'm also trying to address the serialization semantics. SQLite always operates 
at the serializable isolation level. (I'm talking about the SQL concept of 
transaction isolation levels, not the unrelated isolation_level parameter in 
sqlite3.) Currently, since sqlite3 doesn't send a BEGIN before SELECT queries, 
the following scenario is possible:

- Process A reads data -- and the developer who carefully read PEP 249 expects 
to start a transaction
- Process B writes data
- Process A writes a modified version of what it read and commits

In this scenario A overwrites B, breaking the serialization guarantees expected 
in that case. A's initial read should have started a transaction (essentially 
acquiring a shared lock) and B should have been prevented from writing. 

There are two problems here:

- A's code looks like it's safe, but it isn't, because sqlite3 does some magic 
at odds with PEP 249.
- If you're aware of this and try to enforce the proper guarantees, sqlite3 
still gets in the way.

 I also don't understand why we don't just fix the screwy behavior with 
 regards to savepoint.  It's hard to see how fixing that could be a backward 
 compatibility problem (in a feature release), since you can't use savepoints 
 without isolation_level=None as it stands now.

Of course, that would be a good step. But the problem doesn't stop there. What 
about other SQLite commands? What about PRAGMA? I suspect you'll have a hard 
time defining and maintaining a list of which commands should or shouldn't 
begin or commit a transaction. That's why I didn't choose this path.

Furthermore, sqlite3 would still enforce a weird mode where it sacrifices 
serializable isolation under the assumption that you're having a transactional 
and concurrent workload but you don't care about transactional isolation. There 
are other use cases that would be better served:

- by favoring serializability over concurrency (eg. the application file 
format case) -- that's what my standards mode does
- by favoring concurrency over transactions (eg. the web app and the I don't 
care just save this data cases) -- that's what autocommit is for

--

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



[issue21758] Not so correct documentation about asyncio.subprocess_shell method

2014-06-14 Thread Vajrasky Kok

New submission from Vajrasky Kok:

subprocess_shell in asyncio accepts cmd as a string or a bytes but the test 
unit, the documentation and the exception indicates that it only accepts a 
string.

--
assignee: docs@python
components: Documentation, asyncio
files: fix_doc_asyncio_subprocess_shell.patch
keywords: patch
messages: 220567
nosy: docs@python, gvanrossum, haypo, vajrasky, yselivanov
priority: normal
severity: normal
status: open
title: Not so correct documentation about asyncio.subprocess_shell method
versions: Python 3.4, Python 3.5
Added file: 
http://bugs.python.org/file35634/fix_doc_asyncio_subprocess_shell.patch

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



[issue17941] namedtuple should support fully qualified name for more portable pickling

2014-06-14 Thread ctismer

ctismer added the comment:

Ok, I almost forgot about this because I thought my idea
was not considered, and wondered if I should keep that code online.

It is still around, and I could put it into an experimental branch
if someone asks for it.

Missing pull-request on python.org.

--
nosy: +ctismer

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



[issue21751] Expand zipimport to support bzip2 and lzma

2014-06-14 Thread Donald Stufft

Donald Stufft added the comment:

I disagree that there is no large benefit. Python files aren't the only files 
that could exist inside of a zip file. Supporting LZMA import (or bz2) would 
make it easier to have LZMA or bzip2 wheels in the future without losing the 
ability to import them.

--

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



[issue20577] IDLE: Remove FormatParagraph's width setting from config dialog

2014-06-14 Thread Tal Einat

Tal Einat added the comment:

With very minor changes (just use default=72 instead of or 72 and added a 
comment explaining why 72 is the default - see attached), I ran the entire test 
suite (which is a must according to the dev guide). On current default I'm 
getting consistent failures in test_tk and test_ttk_guionly, which don't seem 
related. At least I know I managed to include the tests which require a GUI.

Can I continue with committing the patch despite these failures? I guess I 
should report these failures separately?

--
Added file: http://bugs.python.org/file35635/formatpara - 20577-34-v2.diff

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



[issue21757] Can't reenable menus in Tkinter on Mac

2014-06-14 Thread Ned Deily

Ned Deily added the comment:

Yes, it is a Tk bug.  The Cocoa version of Tk 8.5 that Apple has been shipping 
since OS X 10.6 has numerous problems that have been fixed in more recent 
versions of Tk 8.5.  With the current ActiveTcl 8.5.15, your test appears to 
work correctly.  Unfortunately, you can't easily change the version of Tcl/Tk 
that the Apple-supplied system Pythons use.  One option is to install the 
current Python 2.7.7 from the python.org binary installer along with ActiveTcl 
8.5.15.  There is more information here:

https://www.python.org/download/mac/tcltk/
https://www.python.org/downloads/

--
resolution:  - third party
stage:  - resolved
status: open - closed

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



[issue21751] Expand zipimport to support bzip2 and lzma

2014-06-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

For non-Python files you don't need support of bzip2 or lzma compression in 
zipimport. Use zipfile which supports advanced compression.

--

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



[issue21751] Expand zipimport to support bzip2 and lzma

2014-06-14 Thread Donald Stufft

Donald Stufft added the comment:

I'm not sure what that statement means. There is package data that sits 
alongside python files. These cannot use anything but DEFLATED because 
zipimport doesn't support it.

--

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



[issue20577] IDLE: Remove FormatParagraph's width setting from config dialog

2014-06-14 Thread Tal Einat

Tal Einat added the comment:

Also, this seems like a small change. Should I mention it in Misc/NEWS?

--

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



[issue21759] URL Typo in Documentation FAQ

2014-06-14 Thread are-you-watching-closely

New submission from are-you-watching-closely:

Under this question 
(https://docs.python.org/2/faq/programming.html#my-program-is-too-slow-how-do-i-speed-it-up)
 in the 2.7 programming FAQ, it gives a link to an anecdote that Guido van 
Rossum wrote.

The URL it gives:
http://www.python.org/doc/essays/list2str.html

The correct URL (no .html):
http://www.python.org/doc/essays/list2str

I'm sure there are some people who didn't think to remove the '.html', and 
couldn't find the story.

Just a quick typo fix.

--
assignee: docs@python
components: Documentation
messages: 220575
nosy: are-you-watching-closely, docs@python
priority: normal
severity: normal
status: open
title: URL Typo in Documentation FAQ
versions: Python 2.7

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



[issue21760] inspect documentation describes module type inaccurately

2014-06-14 Thread Eric Snow

New submission from Eric Snow:

In the documentation for the inspect module, the module type is described with 
just 2 of its potential 7 attributes.  The language reference[2] and importlib 
docs[3] both provide an accurate list of module attributes.

Furthermore, the description for __file__ should be fixed.  It should be clear 
that __file__ reflects the location from which the module was loaded, that 
location is not necessarily a filename, and the attribute may not exist if the 
module was not loaded from a specific location (e.g. builtin and frozen 
modules).  The same goes for __cached__

[1] https://docs.python.org/dev/library/inspect.html#types-and-members
[2] 
https://docs.python.org/3/reference/import.html#import-related-module-attributes
[3] 
https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec

--
assignee: docs@python
components: Documentation
messages: 220576
nosy: docs@python, eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: inspect documentation describes module type inaccurately
versions: Python 3.4, Python 3.5

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



[issue19768] Not so correct error message when giving incorrect type to maxlen in deque

2014-06-14 Thread Claudiu Popa

Claudiu Popa added the comment:

I believe that returning a TypeError instead of a ValueError is better in this 
situation. Technically, passing 'a' as maxlen makes that value inappropiate, 
thus the use of TypeError. It will also be backward compatible. Also, your 
patch needs test updates.

--
nosy: +Claudiu.Popa
stage:  - patch review
versions: +Python 3.5 -Python 2.7, Python 3.3, Python 3.4

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



[issue21760] inspect documentation describes module type inaccurately

2014-06-14 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +brett.cannon, ncoghlan

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



[issue19898] No tests for dequereviter_new

2014-06-14 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
stage: needs patch - patch review
versions: +Python 3.5

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



[issue21761] language reference describes the role of module.__file__ inaccurately

2014-06-14 Thread Eric Snow

New submission from Eric Snow:

The language reference [1] says:

  Ultimately, the loader is what makes use of __file__ and/or __cached__

This implies that loaders should use __file__ and __cached__ when loading a 
module.  Instead loaders are meant to implement exec_module() and use the spec 
that's passed in.

The entire section should have a clear note that loaders are not meant to rely 
a module's import-related attributes.

[1] https://docs.python.org/3/reference/import.html#__file__
[2] 
https://docs.python.org/3/reference/import.html#import-related-module-attributes

--
messages: 220578
nosy: barry, brett.cannon, eric.snow, ncoghlan
priority: normal
severity: normal
status: open
title: language reference describes the role of module.__file__ inaccurately
versions: Python 3.4, Python 3.5

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



[issue21761] language reference describes the role of module.__file__ inaccurately

2014-06-14 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python
stage:  - needs patch

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



[issue21151] winreg.SetValueEx causes crash if value = None

2014-06-14 Thread Claudiu Popa

Claudiu Popa added the comment:

Hi. You have some trailing whitespaces in the test file (run make patchcheck or 
python ../Tools/scripts/patchcheck.py). Except that, looks good to me.

--
nosy: +Claudiu.Popa
stage:  - patch review
versions: +Python 3.5 -Python 3.4

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



[issue21759] URL Typo in Documentation FAQ

2014-06-14 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
keywords: +easy
nosy: +ezio.melotti
stage:  - needs patch
type:  - enhancement

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



[issue19898] No tests for dequereviter_new

2014-06-14 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee:  - rhettinger
versions:  -Python 3.4

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



[issue15955] gzip, bz2, lzma: add option to limit output size

2014-06-14 Thread Nikolaus Rath

Nikolaus Rath added the comment:

Nadeem, did you get a chance to look at this?

--

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



[issue21762] update the import machinery to only use __spec__

2014-06-14 Thread Eric Snow

New submission from Eric Snow:

With PEP 451, Python 3.4 introduced module specs to encapsulate the module's 
import-related information, particularly for loading.  While __loader__, 
__file__, and __cached__ are no longer used by the import machinery, in a few 
places it still uses __name__, __package__, and __path__.

Typically the spec and the module attrs will have the same values, so it would 
be a non-issue.  However, the import-related module attributes are not 
read-only and the consequences of changing them (i.e. accidentally or to rely 
on an implementation detail) are not clearly defined.  Making the spec strictly 
authoritative reduces the likelihood accidental changes and gives a better 
focus point for a module's import behavior (which was kind of the point of PEP 
451 in the first place).  Furthermore, objects in sys.modules are not required 
to be modules.  By relying strictly on __spec__ we likewise give a more 
distinct target (of import-related info) for folks that need to use that trick.

I don't recall the specifics on why we didn't change those 3 attributes for PEP 
451 (unintentional or for backward compatibility?).  At one point we discussed 
the idea that a module's spec contains the values that *were* used to load the 
module.  Instead, each spec became the image of how the import system sees and 
treats the module.

So unless there's some solid reason, I'd like to see the use of __name__, 
__package__, and __path__ by the import machinery eliminated (and accommodated 
separately if appropriate).  Consistent use of specs in the import machinery 
will help limit future surprises.

Here are the specific places:

__name__

mod.__repr__()
ExtensionFileLoader.load_module()
importlib._bootstrap._handle_fromlist()
importlib._bootstrap._calc___package__()
importlib._bootstrap.__import__()

__package__
---
importlib._bootstrap._calc___package__()

__path__

importlib._bootstrap._find_and_load_unlocked()
importlib._bootstrap._handle_fromlist()
importlib._bootstrap._calc___package__()

__file__

mod.__repr__()

Note that I'm not suggesting the module attributes be eliminated (they are 
useful for informational reasons).  I would just like the import system to stop 
using them.  I suppose they could be turned into read-only properties, but 
anything like that should be addressed in a separate issue.

If we do make this change, the language reference, importlib docs, and inspect 
docs should be updated to clearly reflect the role of the module attributes in 
the import system.

I have not taken into account the impact on the standard library.  However, I 
expect that it will be minimal at best.  (See issue #21736 for a related 
discussion).

--
components: Interpreter Core
messages: 220581
nosy: brett.cannon, eric.snow, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: update the import machinery to only use __spec__
type: enhancement
versions: Python 3.4, Python 3.5

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



[issue20069] Add unit test for os.chown

2014-06-14 Thread Claudiu Popa

Claudiu Popa added the comment:

Hi, I left a couple of comments on rietveld.

--
nosy: +Claudiu.Popa

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



[issue21756] IDLE - ParenMatch fails to find closing paren of multi-line statements

2014-06-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The current behavior is documented, if not exactly 'chosen' as the best 
possible. return the indices of the opening bracket and the closing bracket 
(or the end of line, whichever comes first. 

As you note, the automatic matching when pausing afte typing a closer only 
needs to search back, and that should not be affected. When I type ^0, I am 
willing to wait the extra 1/20? of a second to get a proper highlight.

To see if anything might depend on the truncated search, I grepped

Searching 'get_surrounding_brackets' in C:\Programs\Python34\Lib\idlelib\*.py 
...
CallTips.py: 66: sur_paren = hp.get_surrounding_brackets('(')
HyperParser.py: 105: def get_surrounding_brackets(self, openers='([{', 
mustclose=False):
ParenMatch.py: 93: indices = HyperParser(self.editwin, 
insert).get_surrounding_brackets()
ParenMatch.py: 109: indices = 
hp.get_surrounding_brackets(_openers[closer], True)

So we have to make sure that calltips are not disabled or burdened. (The 
'testing' you said is needed.)

I don't understand the call because the goal is to find the expression 
preceding '('. There usually is no matching ')' after '(' just typed.  I just 
know that unless unless evalfuncs is True, calltips are not fetched when the 
function expression contains a function call. 'f(' gives a calltip for f, but 
'f()(' does not call f to give a calltip for f().

--

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



[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-06-14 Thread Nikolaus Rath

Nikolaus Rath added the comment:

Raymond, it would be nice if you could respond to my last comment...

--

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



[issue21756] IDLE - ParenMatch fails to find closing paren of multi-line statements

2014-06-14 Thread Tal Einat

Tal Einat added the comment:

Note that the patch changes the behavior only for 
ParenMatch.flash_paren_event(). Other uses, such as in CallTips, are not 
affected.

The only possibly unwanted effect that I can think of is in an editor window, 
on a line missing a closing parenthesis, triggering flash_paren_event() could 
highlight the entire rest of the code. I'll have to check this tomorrow.

WRT CallTips.open_calltip() calling HyperParser.get_surrounding_parens('('), 
that is to find the real last opening parenthesis. It is needed since 
open_calltip() can be triggered manually, not only after '(' is typed.

--

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



[issue21736] Add __file__ attribute to frozen modules

2014-06-14 Thread Eric Snow

Eric Snow added the comment:

__file__ is the filename from which the module *was* loaded (the inspect doc 
[1] should probably reflect that [2]).  The import machinery only uses the 
module's __spec__ (origin, etc.).  __file__ is set strictly as informational 
(and for backward-compatibility).

Per the language reference [3], __file__ may be omitted when it does not have 
semantic meaning.  It also says Ultimately, the loader is what makes use of 
__file__, but that hasn't been accurate since PEP 451 landed. [4]  Notably, 
though, for now the module __repr__() *does* use __file__ if it is available 
(and the loader doesn't implement module_repr).  The counterpart of __file__ 
within a module's spec is __spec__.origin.  The two should stay in sync.  In 
the case of frozen modules origin is set to frozen.

Giving __file__ to frozen modules is inaccurate.  The file probably won't be 
there and the module certainly wasn't loaded from that location.

Stdlib modules should not rely on all module's having __file__.  Removing 
__file__ from frozen modules was a change in 3.4 and I'd consider it a 3.4 bug 
if any stdlib module relied on it.  For that matter, I'd consider it a bug if a 
module relied on all modules having __file__ or even __file__ being set to an 
actual filename.

Would it be inappropriate to set an additional informational attribute on 
frozen modules to indicate the original path?  Something like 
__frozen_filename__.  Then you wouldn't need to rely on __code__.co_filename.

p.s. Searching for __file__ in the docs [5] illustrates its prevalence.

[1] https://docs.python.org/3/library/inspect.html#types-and-members
[2] issue #21760
[3] https://docs.python.org/3/reference/import.html#__file__
[4] issue #21761
[5] https://docs.python.org/3/search.html?q=__file__

--
nosy: +brett.cannon, eric.snow, ncoghlan

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



[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-14 Thread Eric Snow

Eric Snow added the comment:

 addLevelName.__code__.co_filename

Isn't __code__ implementation-specific?

--
nosy: +eric.snow

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



[issue21763] Clarify requirements for file-like objects

2014-06-14 Thread Nikolaus Rath

New submission from Nikolaus Rath:

It is currently not perfectly clear what Python (and the standard library) 
assumes about file-like objects (see e.g. 
http://article.gmane.org/gmane.comp.python.devel/148199).

The attached doc patch tries to improve the current situation by  stating 
explicitly that the description of IOBase et al specifies a *mandatory* 
interface for anything that claims to be file-like.

--
assignee: docs@python
components: Documentation
files: iobase.diff
keywords: patch
messages: 220588
nosy: benjamin.peterson, docs@python, eric.araujo, ezio.melotti, georg.brandl, 
hynek, ncoghlan, nikratio, pitrou, stutzbach
priority: normal
severity: normal
status: open
title: Clarify requirements for file-like objects
type: enhancement
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35636/iobase.diff

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



[issue17004] Expand zipimport to include other compression methods

2014-06-14 Thread Eric Snow

Eric Snow added the comment:

related: issue #17630 and issue #5950

--
nosy: +eric.snow

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



[issue21751] Expand zipimport to support bzip2 and lzma

2014-06-14 Thread Eric Snow

Eric Snow added the comment:

related: issue #17630

--

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



[issue21764] Document that IOBase.__del__ calls self.close

2014-06-14 Thread Nikolaus Rath

New submission from Nikolaus Rath:

CPython's io.IOBase.__del__ calls self.close(), but this isn't documented 
anywhere (and may be surprised for derived classes).

The attached patch extends the documentation.

--
assignee: docs@python
components: Documentation
files: iobase2.diff
keywords: patch
messages: 220591
nosy: benjamin.peterson, docs@python, eric.araujo, ezio.melotti, georg.brandl, 
hynek, nikratio, pitrou, stutzbach
priority: normal
severity: normal
status: open
title: Document that IOBase.__del__ calls self.close
type: enhancement
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35637/iobase2.diff

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



[issue21764] Document that IOBase.__del__ calls self.close

2014-06-14 Thread Nikolaus Rath

Changes by Nikolaus Rath nikol...@rath.org:


Removed file: http://bugs.python.org/file35637/iobase2.diff

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



[issue21764] Document that IOBase.__del__ calls self.close

2014-06-14 Thread Nikolaus Rath

Changes by Nikolaus Rath nikol...@rath.org:


Added file: http://bugs.python.org/file35638/iobase2.diff

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



[issue21759] URL Typo in Documentation FAQ

2014-06-14 Thread Mike Short

Changes by Mike Short bmsh...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file35639/programmingfaq.patch

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



[issue21756] IDLE - ParenMatch fails to find closing paren of multi-line statements

2014-06-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I suspect that the new end_at_eol parameter should take care of calltips.

--

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



[issue21765] Idle: make 3.x HyperParser work with non-ascii identifiers.

2014-06-14 Thread Terry J. Reedy

New submission from Terry J. Reedy:

idlelib.HyperParser.Hyperparser has these lines
_whitespace_chars =  \t\n\\
_id_chars = string.ascii_letters + string.digits + _
_id_first_chars = string.ascii_letters + _
used in _eat_identifier() and get_expression. At least the latter two should be 
turned into functions that access the unicode datebase. (Such functions, if not 
already present in the stdlib, should be. But adding something elsewhere would 
be another issue.)

--
messages: 220593
nosy: taleinat, terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: Idle: make 3.x HyperParser work with non-ascii identifiers.
type: behavior
versions: Python 3.4, Python 3.5

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



[issue21756] IDLE - ParenMatch fails to find closing paren of multi-line statements

2014-06-14 Thread Terry J. Reedy

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


--
dependencies: +IDLE - Test hyperparser
stage:  - test needed

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



[issue21686] IDLE - Test hyperparser

2014-06-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Since ParenMatch and fixes* to HyperParser depend on this issue, I would like 
to do this first. For HyperParser.py, I would like to first commit a clean-up 
only patch. The test_hyperparser patch should then only add the 'if __name__' 
clause at the end.

I would like to apply the attached tomorrow, pending comments. It
adds docstrings and properly formats them per PEP 8; reformats comment blocks, 
and properly wrap lines without '\', eliminating occurences already present.

The v1 tests continue to pass once 'before the analyzed' is changed in the test 
file to 'precedes'. 'Index' or 'statement' might be better targets. 

*After test_hyperparser.py is added, additional tests for #21756 (finding 
closers) and new #21765 -- making HyperParser work with non-ascii identifiers, 
will be added as part of any code fix patches.

--
Added file: http://bugs.python.org/file35640/hyperparser_update.diff

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



[issue21765] Idle: make 3.x HyperParser work with non-ascii identifiers.

2014-06-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

#21686 adds the test file that a new test would go in.

--
dependencies: +IDLE - Test hyperparser

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



[issue20577] IDLE: Remove FormatParagraph's width setting from config dialog

2014-06-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

General rule: If the other failures happen without the patch, then go ahead. 
This is, unfortunately, all too common. If they only happen with the patch 
(extremely unlikely for this one), then try to find out why.

Yes, this change should have a NEWS item. However, I would not include it with 
your first patch. On my machine, hg has trouble properly merging changes to 
NEWS even when there are no real conflicts. I have a couple of other items for 
committed patches that I intend to push separately very soon and I would 
include this one if appropriate.

--

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



[issue21762] update the import machinery to only use __spec__

2014-06-14 Thread Nick Coghlan

Nick Coghlan added the comment:

Manipulating name, package and path at runtime is fully supported, and the
module level attributes accordingly take precedence over the initial import
time spec.

There may be some test suite gaps and documentation issues around the
behaviour, but it's definitely intentional (things like runpy,
pseudo-modules, third party namespace package support and workarounds for
running modules inside packages correctly rely on it).

--

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



[issue21736] Add __file__ attribute to frozen modules

2014-06-14 Thread Nick Coghlan

Nick Coghlan added the comment:

Can we just drop __file__ and set the origin for frozen modules to
something that includes the original file name?

--

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



[issue21751] Expand zipimport to support bzip2 and lzma

2014-06-14 Thread Nick Coghlan

Nick Coghlan added the comment:

Another use case is more aggressively shrinking the bundled copy of pip. We
don't really care about speed of execution there (since we only run it
directly once at install time to do the bootstrapping), but we do care
about the impact on the installer size.

However, that's a fairly specialised case - for wheel 2.0 in general, we
can consider dropping the always usable as a sys.path entry behaviour and
not need to worry about the constraints of zipimport (which has indeed
exhibited unfortunate we touch it, we break it behaviour in recent
releases, due to the vagaries of zip implementations on various platforms).

A more general archive importer written in Python could also be useful -
there's no requirement that all archive formats be handled by the existing
meta importer. Putting such an importer *after* the existing zip importer
in the metapath would minimise any risk of backwards incompatibility
issues, and allow it to initially be created as a third party module on
PyPI.

--

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



[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-06-14 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Sorry Nikolaus, I'm happy with the code and docs as they are.  In general, you 
should assume that unless documented otherwise, any pure python container 
(stdlib or 3rd party) has undefined behavior if you mutate while iterating 
(like you should not assume thread-safety unless a container is documented as 
threadsafe).  At your behest, I added extra code to trigger an earlier and more 
visible failure in some circumstances, but that is the limit.  OrderedDicts 
have been around for a good while (not just the stdlib but also in other code 
predating the one in the stdlib), so we know that this hasn't been a problem in 
practice. 

Please declare victory, move on, and don't keep extending this closed thread.

--

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



[issue17941] namedtuple should support fully qualified name for more portable pickling

2014-06-14 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
versions: +Python 3.5 -Python 3.4

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



[issue21709] logging.__init__ assumes that __file__ is always set

2014-06-14 Thread Vinay Sajip

Vinay Sajip added the comment:

 Isn't __code__ implementation-specific?

It is, but ISTM it's worth getting a resolution for #21736 before another patch 
for this issue is developed.

--

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



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2014-06-14 Thread Jim Jewett

Jim Jewett added the comment:

On Jun 14, 2014 4:05 AM, Aymeric Augustin

 preserving the same behavior by default

That is a requirement, because of backwards compatibility.

 providing more control for users who need a different behavior, for
instance people who use SQLite as an application file format or as a web
application storage backend.

Great ... but make sure it is also simpler.  It is already *possible* to do
what you want with 3rd party code.  So if doing it right would still
require an arcane recipe,  that isn't a gain.

At a minimum,  the new docs should explain why the current default is not
sufficient for an application file or a Web backend, and what to do
instead.  New code is only justified if it makes the do this instead
simpler and more obvious.

My personal opinion is still that adding more keywords won't do this,
because the old ones will still be there to confuse ... thus my suggestion
of a new function.

  When starting with Python I always thought that code like this is
harmles:

  conn = sqlite3.connect(test.db)
  data = list(conn.execute(select * from mytable))

  Currently it is, but only because sqlite3 module parses the select as
DQL and does not lock the database.

 It will absolutely remain harmless with my proposal, if you don't change
your code.

 However, for that use case I would like to encourage the use of
autocommit mode. That's really the semantics you want here.

I should NOT need to mess with anything related to commit if I am just
selecting.  If that means another new function for
lockless/read-only/uncommitted-read connections, then so be it.

 My take is to avoid the problem entirely, and not inflict it to new
users, by providing an option to start in autocommit mode and then create
transactions only when you want them.

But again, if it requires choosing a commit mode for my selects,  then it
fails to be simple.

--

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



[issue21766] CGIHTTPServer File Disclosure

2014-06-14 Thread Benjamin Peterson

New submission from Benjamin Peterson:

From the security list:

The CGIHTTPServer Python module does not properly handle URL-encoded
path separators in URLs. This may enable attackers to disclose a CGI
script's source code or execute arbitrary scripts in the server's
document root.

Details
===

Product: Python CGIHTTPServer
Affected Versions: 2.7.5, 3.3.4 (possibly others)
Fixed Versions: FIXED-VERSIONS
Vulnerability Type: File Disclosure, Directory Traversal
Security Risk: high
Vendor URL: https://docs.python.org/2/library/cgihttpserver.html
Vendor Status: notified
Advisory URL: https://www.redteam-pentesting.de/advisories/rt-sa-2014-008
Advisory Status: private
CVE: GENERIC-MAP-NOMATCH
CVE URL: https://cve.mitre.org/cgi-bin/cvename.cgi?name=GENERIC-MAP-NOMATCH


Introduction


The CGIHTTPServer module defines a request-handler class, interface
compatible with BaseHTTPServer. BaseHTTPRequestHandler and inherits
behavior from SimpleHTTPServer. SimpleHTTPRequestHandler but can also
run CGI scripts.

(from the Python documentation)

More Details


The CGIHTTPServer module can be used to set up a simple HTTP server with
CGI scripts. A sample server script in Python may look like the
following:


#!/usr/bin/env python2

import CGIHTTPServer
import BaseHTTPServer

if __name__ == __main__:
server = BaseHTTPServer.HTTPServer
handler = CGIHTTPServer.CGIHTTPRequestHandler
server_address = (, 8000)
# Note that only /cgi-bin will work:
handler.cgi_directories = [/cgi-bin, /cgi-bin/subdir]
httpd = server(server_address, handler)
httpd.serve_forever()


This server should execute any scripts located in the subdirectory
cgi-bin. A sample CGI script can be placed in that directory, for
example a script like the following:


#!/usr/bin/env python2
import json
import sys

db_credentials = SECRET
sys.stdout.write(Content-type: text/json\r\n\r\n)
sys.stdout.write(json.dumps({text: This is a Test}))


The Python library CGIHTTPServer.py implements the CGIHTTPRequestHandler
class which inherits from SimpleHTTPServer.SimpleHTTPRequestHandler:

class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
[...]
def do_GET(self):
Serve a GET request.
f = self.send_head()
if f:
try:
self.copyfile(f, self.wfile)
finally:
f.close()

def do_HEAD(self):
Serve a HEAD request.
f = self.send_head()
if f:
f.close()

def translate_path(self, path):
[...]
path = posixpath.normpath(urllib.unquote(path))
words = path.split('/')
words = filter(None, words)
path = os.getcwd()
[...]

The CGIHTTPRequestHandler class inherits, among others, the methods
do_GET() and do_HEAD() for handling HTTP GET and HTTP HEAD requests. The
class overrides send_head() and implements several new methods, such as
do_POST(), is_cgi() and run_cgi():

class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
[...]
def do_POST(self):
[...]
if self.is_cgi():
self.run_cgi()
else:
self.send_error(501, Can only POST to CGI scripts)

def send_head(self):
Version of send_head that support CGI scripts
if self.is_cgi():
return self.run_cgi()
else:
return SimpleHTTPServer.SimpleHTTPRequestHandler.send_head(self)

def is_cgi(self):
[...]
collapsed_path = _url_collapse_path(self.path)
dir_sep = collapsed_path.find('/', 1)
head, tail = collapsed_path[:dir_sep], collapsed_path[dir_sep+1:]
if head in self.cgi_directories:
self.cgi_info = head, tail
return True
return False
[...]
def run_cgi(self):
Execute a CGI script.
dir, rest = self.cgi_info

[...]

# dissect the part after the directory name into a script name 
# a possible additional path, to be stored in PATH_INFO.
i = rest.find('/')
if i = 0:
script, rest = rest[:i], rest[i:]
else:
script, rest = rest, ''

scriptname = dir + '/' + script
scriptfile = self.translate_path(scriptname)
if not os.path.exists(scriptfile):
self.send_error(404, No such CGI script (%r) % scriptname)
return
if not os.path.isfile(scriptfile):
self.send_error(403, CGI script is not a plain file (%r) %
scriptname)
return
[...]
[...]

For HTTP GET requests, do_GET() first invokes send_head(). That method
calls is_cgi() to determine whether the 

[issue21766] CGIHTTPServer File Disclosure

2014-06-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b4bab0788768 by Benjamin Peterson in branch '2.7':
url unquote the path before checking if it refers to a CGI script (closes 
#21766)
http://hg.python.org/cpython/rev/b4bab0788768

New changeset e47422855841 by Benjamin Peterson in branch '3.2':
url unquote the path before checking if it refers to a CGI script (closes 
#21766)
http://hg.python.org/cpython/rev/e47422855841

New changeset 5676797f3a3e by Benjamin Peterson in branch '3.3':
merge 3.2 (#21766)
http://hg.python.org/cpython/rev/5676797f3a3e

New changeset 847e288d6e93 by Benjamin Peterson in branch '3.4':
merge 3.3 (#21766)
http://hg.python.org/cpython/rev/847e288d6e93

New changeset f8b3bb5eb190 by Benjamin Peterson in branch 'default':
merge 3.4 (#21766)
http://hg.python.org/cpython/rev/f8b3bb5eb190

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue21764] Document that IOBase.__del__ calls self.close

2014-06-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 601a08fcb507 by Benjamin Peterson in branch '3.4':
document IOBase.__del__'s behavior (closes #21764)
http://hg.python.org/cpython/rev/601a08fcb507

New changeset 4dca82f8d91d by Benjamin Peterson in branch '2.7':
document IOBase.__del__'s behavior (closes #21764)
http://hg.python.org/cpython/rev/4dca82f8d91d

New changeset 787cd41d0404 by Benjamin Peterson in branch 'default':
merge 3.4 (#21764)
http://hg.python.org/cpython/rev/787cd41d0404

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue21762] update the import machinery to only use __spec__

2014-06-14 Thread Eric Snow

Eric Snow added the comment:

Thanks for clarifying.  I remembered discussing it but couldn't recall the 
details.  Documenting the exact semantics, use cases, and difference between 
spec and module attrs would be help.  I'll look into updating the language 
reference when I have some time.

It would still be worth it to find a way to make __spec__ fully authoritative, 
but I'll have to come up with a solution to the current use cases before that 
could go anywhere. :)

--

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



[issue19768] Not so correct error message when giving incorrect type to maxlen in deque

2014-06-14 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee:  - rhettinger

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



[issue19768] Not so correct error message when giving incorrect type to maxlen in deque

2014-06-14 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
priority: normal - low

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



[issue19768] Not so correct error message when giving incorrect type to maxlen in deque

2014-06-14 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Sorry, but I don't find this to be an improvement and don't think there is a 
real problem worth fixing.

--
resolution:  - rejected
status: open - closed

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



[issue19898] No tests for dequereviter_new

2014-06-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4a48450f2505 by Raymond Hettinger in branch 'default':
Issue 19898:  Add test for dequereviter_new.
http://hg.python.org/cpython/rev/4a48450f2505

--
nosy: +python-dev

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



  1   2   >