[issue14659] HP multi-thread environment python core in PyObject_GC_UnTrack

2012-04-24 Thread frank

New submission from frank zhang.guoc...@zte.com.cn:

#0  0x1dbaa480:0 in PyObject_GC_UnTrack () at Modules/gcmodule.c:1149
1149Modules/gcmodule.c: No such file or directory.
in Modules/gcmodule.c
(gdb) where
#0  0x1dbaa480:0 in PyObject_GC_UnTrack () at Modules/gcmodule.c:1149
#1  0x1dab7040:0 in tupledealloc () at Objects/tupleobject.c:137
#2  0x1db3c650:0 in code_dealloc () at Python/compile.c:169
#3  0x1dc09e70:0 in func_dealloc () at Objects/funcobject.c:408
#4  0x1da81390:0 in insertdict () at Objects/dictobject.c:390
#5  0x1da82030:0 in PyDict_SetItem () at Objects/dictobject.c:533
#6  0x1db25cd0:0 in eval_frame () at Python/ceval.c:1681
#7  0x1db309d0:0 in PyEval_EvalCodeEx () at Python/ceval.c:2650
#8  0x1db2f9e0:0 in PyEval_EvalCode () at Python/ceval.c:537
#9  0x1db7aa10:0 in PyImport_ExecCodeModuleEx () at Python/import.c:621
#10 0x1db7a850:0 in PyImport_ExecCodeModule () at Python/import.c:588

who can help me, many thanks!

--
components: Interpreter Core
files: P160254_R1699958_120413075145.txt
messages: 159120
nosy: njfrank
priority: normal
severity: normal
status: open
title: HP multi-thread environment python core in PyObject_GC_UnTrack
type: crash
versions: Python 2.6
Added file: http://bugs.python.org/file25337/P160254_R1699958_120413075145.txt

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



[issue3177] Add shutil.open

2012-04-24 Thread Hobs

Hobs hobsonl...@gmail.com added the comment:

I can see why this partial implementation of `operation` in this ver seems
useless. But it is a placeholder for eventually providing Linux/Mac users
with the same functionality as windows. The os.startfile() or
shutil.launch() function can easily fill the gap left by the OS, which is
what os does for lots of other missing  OS features on one platform or
another.

I'll delete the OS9 ('mac') test comment and leave an implementation for
those platforms up to others?

`gui` is for software that intends to launch user's $EDITOR, vi, nano,
emacs, etc. This is intended to generalize startfile to encompass a common
pattern, e.g. in bzr, hg. Perhaps it doesn't belong in ver1 until we sort
out all the other uncomfortable things about this patch.

I'll test all the windows and linux exception possabilities and get back to
you on what exceptions startfile() normally raises, and whether this
implementation of shutil.launch() raises comparable exceptions.

Cheers,
H
On Apr 23, 2012 7:53 PM, Chris Rebert rep...@bugs.python.org wrote:


 Chris Rebert pyb...@rebertia.com added the comment:

 `operation` seems questionable. IMO, the verbs seem stronger / more
 important than mere optional suggestions (particularly open vs. edit
 for files with read-only viewers), and only Windows supports them (so
 anyone requiring that feature might as well just use startfile() directly).
 By virtue of this function being cross-platform, we're kinda limited to
 just supporting the lowest common denominator.

 Hobs, can you explain `gui`?

 Also, does startfile() raise exceptions for either of the basic error
 conditions (no such file and no associated application)? If not, I
 believe using the lower-level ShellExecute (
 http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx)
  or similar Windows API function would allow us to report such errors, as
 the other platform implementations currently do.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue3177
 ___


--

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



[issue14659] HP multi-thread environment python core in PyObject_GC_UnTrack

2012-04-24 Thread frank

frank zhang.guoc...@zte.com.cn added the comment:

in addtion, the version of our python is 2.3.4

--

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 So why the mutation? Are you that worried someone is going to import
 importlib._bootstrap directly?

Well, importing importlib *does* import importlib._bootstrap, and
creates another copy of the module. importlib.__import__ is then wired
to _bootstrap.__import__, which is different from the built-in
__import__ (potentially using different globals, for example).

 This also costs in development complexity because not only do you have
 to run 'make' to get changes to be testable, but it also leads to
 difficult debugging situations where if you are not totally sure you
 got something working you won't find out until you see e.g. that the
 standard I/O streams were not initialized.

I'm worried that two different copies of importlib will lead to its own
difficult debugging situations.

--

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



[issue14654] More fast utf-8 decoding

2012-04-24 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

Thank you, Antoine. It is interesting results, that on 64 bits greatly
accelerated the case, which on 32 bits sped up a little. It was the
pathology that a 2-byte to UCS1 was decoded in 1.5x slower than a 2-byte
to UCS2. Interestingly, a small acceleration for the other cases are
random deviations or consequential effect? Strange looks like the
difference for ascii-only text, this branch is not affected by the
patch. Except that the consequences of global optimization. The
deceleration of the decoding of the 4-byte data is expected.

Here is a patch, which is risky reception with signed numbers. For me,
it shows the acceleration of a few percent in comparison with the
previous patch. But I can not recommend it, it looks too hacker for such
a small improvement. It will not work on the exotic platforms where
signed numbers are implemented not as complement code (but Python is not
supports such platforms).

--

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



[issue14659] HP multi-thread environment python core in PyObject_GC_UnTrack

2012-04-24 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

The complete call stack shows that Python is embedded in another application 
(OCPro).  The issue is most probably with this application which makes a bad 
usage of the C Python API, or somehow overwrites memory.
I suggest that you report this to the application developers.

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - pending

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



[issue14654] More fast utf-8 decoding

2012-04-24 Thread Serhiy Storchaka

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


Added file: http://bugs.python.org/file25338/utf8-signed.diff

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



[issue14659] HP multi-thread environment python core in PyObject_GC_UnTrack

2012-04-24 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

In addition, Python 2.3.4 is completely outdated. The current supported 
versions are 2.7.x and 3.2.x. I recommend you upgrade your Python before 
posting further bug reports.

--
nosy: +pitrou
status: pending - closed

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 This would also mean that changes to importlib._bootstrap would
 actually take effect for user code almost immediately, *without*
 rebuilding Python, as the frozen version would *only* be used to get
 hold of the pure Python version.

Actually, _io, encodings and friends must be loaded before importlib
gets imported from Python code, so you will still have __loader__
entries referencing the frozen importlib, unless you also rewrite these
attributes.

My desire here is not to hide _frozen_importlib, rather to avoid subtle
issues with two instances of a module living in memory with separate
global states. Whether it's the frozen version or the on-disk Python
version that gets the preference is another question (a less important
one in my mind).

--

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Antoine Pitrou wrote:
 
 Antoine Pitrou pit...@free.fr added the comment:
 
 This would also mean that changes to importlib._bootstrap would
 actually take effect for user code almost immediately, *without*
 rebuilding Python, as the frozen version would *only* be used to get
 hold of the pure Python version.
 
 Actually, _io, encodings and friends must be loaded before importlib
 gets imported from Python code, so you will still have __loader__
 entries referencing the frozen importlib, unless you also rewrite these
 attributes.
 
 My desire here is not to hide _frozen_importlib, rather to avoid subtle
 issues with two instances of a module living in memory with separate
 global states. Whether it's the frozen version or the on-disk Python
 version that gets the preference is another question (a less important
 one in my mind).

Why don't you freeze the whole importlib package to avoid all these
issues ? As side effect, it will also load a little faster.

--
nosy: +lemburg

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



[issue12892] UTF-16 and UTF-32 codecs should reject (lone) surrogates

2012-04-24 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

  * fix an error in the error handler for utf-16-le. (In, Python3.2 
 b'\xdc\x80\x00\x41'.decode('utf-16-be', 'ignore') returns \x00 instead of 
 A for some reason)

The patch for issue14579 fixes this in Python 3.2.

The patch for issue14624 fixes this in Python 3.3.

--
nosy: +storchaka

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



[issue2857] Add java modified utf-8 codec

2012-04-24 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

As far as I understand, this codec can be implemented in Python. There is no 
need to modify the interpreter core.

def decode_cesu8(b):
return re.sub('[\uD800-\uDBFF][\uDC00\DFFF]', lambda m: chr(0x1 | 
((ord(m.group()[0])  0x3FF)  10) | (ord(m.group()[1])  0x3FF)), 
b.decode('utf-8', 'surrogatepass'))

def encode_cesu8(s):
return re.sub('[\U0001-\U0010]', lambda m: chr(0xD800 | 
((ord(m.group())  10)  0x3FF)) + chr(0xDC00 | (ord(m.group()  0x3FF)), 
s).encode('utf-8', 'surrogatepass')

def decode_mutf8(b):
return decode_cesu8(b.replace(b'\xC0\x80', b'\x00'))

def encode_mutf8(s):
return encode_cesu8(s).replace(b'\x00', b'\xC0\x80')

--
nosy: +storchaka

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



[issue14660] Implement PEP 420: Implicit Namespace Packages

2012-04-24 Thread Eric V. Smith

New submission from Eric V. Smith e...@trueblade.com:

I have created a branch features/pep-420 where I'll be developing a proof of 
concept implementation of PEP 420.

I've checked in a basic version, but it has these issues:

- We need to decide how finders communicate that they've found part of
a namespace package. Per Brett's suggestion, I'm currently returning a
string that means the returned path is part of a namespace package.
I think that's an okay design.

- I guess we need to create a namespace loader, so we can initialize 
__loader__. It's a little odd because it would be a loader for which there's no 
need for a find_module method. I'm currently setting __loader__ to the finder, 
which is completely wrong, but keeps things working.

- test_import and test_importlib both fail because they're checking
that imports with no __init__.py fail. Those tests need to be removed.

- There are no tests yet.

--
assignee: eric.smith
messages: 159131
nosy: barry, brett.cannon, eric.smith, jason.coombs
priority: normal
severity: normal
status: open
title: Implement PEP 420: Implicit Namespace Packages
type: enhancement
versions: Python 3.3

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



[issue14654] More fast utf-8 decoding

2012-04-24 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

I'm -1 on using signed char in the implementation. If this gives any advantage, 
it's because the compiler is not able to generate as efficient code for 
unsigned char as it does for signed char. So the performance results may again 
change if you switch compilers, or use the next compiler version.

The code should do what is *logically* correct; IMO, UTF-8 is really a sequence 
of unsigned bytes, conceptually.

So if you want to demonstrate any performance improvements, you need to do so 
with unsigned chars.

--
nosy: +loewis

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



[issue2857] Add java modified utf-8 codec

2012-04-24 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Serhiy: your functions to not constitute a Python codec. For example, there is 
no support for error handlers in them.

--
nosy: +loewis

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



[issue14654] More fast utf-8 decoding

2012-04-24 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 I'm -1 on using signed char in the implementation.

I completely agree with you, for these and for other not mentioned
reasons. So I don't released this patch yesterday, and did not suggest
it to accept. I showed him just out of curiosity -- whether the effect
is stronger on a 64-bit platform? Although this technique will not be
accepted, it sets the bar that can be achieved (if it's worth it).

--

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



[issue14579] Vulnerability in the utf-16 decoder after error handling

2012-04-24 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Now I see the problem: make_decode_exception creates a new bytes object in any 
case, regardless of whether the error handler will update it or not. Therefore, 
decoding will continue in this new bytes object.

I think the same issue also applies to the ASCII decoder in 3.3.

--

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



[issue2857] Add java modified utf-8 codec

2012-04-24 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 Serhiy: your functions to not constitute a Python codec. For example, there 
 is no support for error handlers in them.

Yes, it is not a codec in Python library terminology. It's just a pair
of functions, the COder and DECoder, which is enough for the task of
hacking Java serialized data. I don't think that such specific task
leads to the change of the interpreter core.

However, translators that convert the non-BMP characters to a surrogate
pair and back, would be useful in the standard library. They need to
work with a non-standard encodings (CESU-8, MUTF-8, cp65001, some
Tk/IDLE issues). This is a fairly common task.

--

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



[issue2857] Add java modified utf-8 codec

2012-04-24 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Ok, I'm closing this entire issue as won't fix, then. There apparently is a 
need for functionality like this, but there is apparently also a concern that 
this is too specialized for the standard library.

As it is possible to implement this as a stand-alone library, I encourage 
interested users to design a package for PyPI that has this functionality 
collected for reuse. If the library is then widely used after some time, this 
issue can be reconsidered.

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

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



[issue14579] Vulnerability in the utf-16 decoder after error handling

2012-04-24 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 I think the same issue also applies to the ASCII decoder in 3.3.

No, the ASCII decoder is not affected by this vulnerability. In a loop,
in which unicode_decode_call_errorhandler is called, do not use any
cached and not-updatable data.

--

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



[issue13903] New shared-keys dictionary implementation

2012-04-24 Thread Mark Shannon

Mark Shannon m...@hotpy.org added the comment:

Failing to maintain GC tracking in setdefault and copy (for split-tables)

Patch attached

--
Added file: http://bugs.python.org/file25339/gc_tracking.patch

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



[issue14658] Overwriting dict.__getattr__ is inconsistent

2012-04-24 Thread Anthony Kong

Changes by Anthony Kong anthony.hw.k...@gmail.com:


--
nosy: +Anthony.Kong

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



[issue1065986] Fix pydoc crashing on unicode strings

2012-04-24 Thread Stefano Taschini

Stefano Taschini tasch...@ieee.org added the comment:

Shouldn't this be reopened for Python 2.7 ?

--
type:  - behavior
versions: +Python 2.7 -Python 2.5

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



[issue1065986] Fix pydoc crashing on unicode strings

2012-04-24 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I don't think so.  We aren't promising unicode support in pydoc in 2.x, and it 
is too late to add it.

--

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



[issue14658] Overwriting dict.__getattr__ is inconsistent

2012-04-24 Thread Mark Shannon

Changes by Mark Shannon m...@hotpy.org:


--
nosy: +Mark.Shannon

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



[issue11603] Python crashes or hangs when rebinding __repr__ as __str__

2012-04-24 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

I claim the correct behavior of this is actually to give an recursion provoked 
RuntimeError.

--
nosy: +benjamin.peterson

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



[issue13903] New shared-keys dictionary implementation

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 507a6703d6a3 by Benjamin Peterson in branch 'default':
fix dict gc tracking (#13903)
http://hg.python.org/cpython/rev/507a6703d6a3

--

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



[issue10941] imaplib: Internaldate2tuple produces wrong result if date is near a DST change

2012-04-24 Thread Alexander Belopolsky

Alexander Belopolsky alexander.belopol...@gmail.com added the comment:

My bad.  For some reason I assumed that the latest patch would be at the top of 
the files list.

David, the patch is good.  Should I go ahead and commit?

--

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



[issue14605] Make import machinery explicit

2012-04-24 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Of course you did because you just like making my life a living hell when it 
comes to the __file__ attribute. =)

OK, I will have another look when I get home, but last time I dealt with this 
the issue is some tests expect a relative path while others expect an absolute 
one. And allowing an empty string for the current directory is just evil.

--

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



[issue10941] imaplib: Internaldate2tuple produces wrong result if date is near a DST change

2012-04-24 Thread Joe Peterson

Joe Peterson j...@skyrush.com added the comment:

Great to hear, Alexander.  Thanks for reviewing!  Is it also possible to get 
the pyhton2.7 version one in?

--

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



[issue14660] Implement PEP 420: Implicit Namespace Packages

2012-04-24 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Loaders are not meant to have a find_module method; that is purely for finders 
which can be distinct objects. So having a namespace loader is expected and 
there is no expectation that it have a find_module method (actually almost all 
of the loaders in importlib lack a find_module method).

--

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



[issue10941] imaplib: Internaldate2tuple produces wrong result if date is near a DST change

2012-04-24 Thread Alexander Belopolsky

Alexander Belopolsky alexander.belopol...@gmail.com added the comment:

On Tue, Apr 24, 2012 at 10:42 AM, Joe Peterson rep...@bugs.python.org wrote:
..
  Is it also possible to get the pyhton2.7 version one in?

I don't see any reason not to.  This is a bug fix and should go into a
maintenance release.  I will wait to hear from David, who is the
maintainer of this module, though.

--

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



[issue13756] Python3.2.2 make fail on cygwin

2012-04-24 Thread Lohoris

Changes by Lohoris loo...@gmail.com:


--
nosy: +Lohoris
type:  - compile error

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



[issue14605] Make import machinery explicit

2012-04-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Brett Cannon wrote:
 I am not exposing SourcelessFileLoader because importlib publicly tries to 
 discourage the shipping of .pyc files w/o their corresponding source files. 
 Otherwise all objects as used by importlib for performing imports will become 
 public.

What's the reasoning behind this idea ? Is Python 3.3 no longer meant to
be used for closed source applications ?

--
nosy: +lemburg

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



[issue14660] Implement PEP 420: Implicit Namespace Packages

2012-04-24 Thread Eric V. Smith

Eric V. Smith e...@trueblade.com added the comment:

Right, that's a typo. I meant load_module(). I'm currently working on 
implementing the loader for namespace modules, so my comment about the loader 
is premature.

--

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



[issue10941] imaplib: Internaldate2tuple produces wrong result if date is near a DST change

2012-04-24 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

If you are satisfied with the time logic then yes, please apply it.  I suspect 
that the number of people using the code and not aware of the problem (or not 
caring enough to do anything about it) exceeds the number aware of it who have 
coded a workaround, so I think putting it in 2.7 (and 3.2) is better than not 
doing so.

--

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



[issue11603] Python crashes or hangs when rebinding __repr__ as __str__

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 971865f12377 by Benjamin Peterson in branch '3.2':
don't use a slot wrapper from a different special method (closes #14658)
http://hg.python.org/cpython/rev/971865f12377

--

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



[issue14658] Overwriting dict.__getattr__ is inconsistent

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 971865f12377 by Benjamin Peterson in branch '3.2':
don't use a slot wrapper from a different special method (closes #14658)
http://hg.python.org/cpython/rev/971865f12377

New changeset 0c1c8f8955d8 by Benjamin Peterson in branch 'default':
merge 3.2 (#14658)
http://hg.python.org/cpython/rev/0c1c8f8955d8

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

To start, I'm *not* going to make the final call on this issue's solution. I'm 
inches away from importlib burnout and general integration frustration with 
trying to clean up the implicit behaviour. So to prevent me from making a bad 
decision I will you guys make the final call.

Anyway, I see two options here. One is the let _frozen_importlib be *the* 
implementation, period argument put forth by Antoine (MAL's freeze 
everything also falls under this since it suffers from the same issues). This 
is the easiest solution for the issue of not having overlapping implementations 
and cause potential mix-ups, etc. The issue becomes development difficulty goes 
up as now you are adding a compile step where if you screw up you can get 
really bad error messages (e.g. standard streams could not be created kind of 
stuff). This could theoretically be overcome if the importlib tests all used a 
manually created module directly from the source code to verify things before 
rebuilding (as well as making sure sys.path_importer_cache was cleaned out). 
With a restructuring of importlib's tests to use a common TestCase with the 
proper setUp()/teardown() for keeping things clean along with class and module 
fixtures to prevent obscene stuff like re-importing for every test metho
 d. Another option is we hide the source as _importlib or something to allow 
direct importation w/o any tricks under a protected name.

Then there is Nick's proposal of using _frozen_importlib to start up and then 
swap out with a new version created from the source during startup. This keeps 
development simple since the tests run against the code *almost* all other code 
will use and thus eliminate the test. The problem here is that startup is a 
smidgen slower and it requires you blacklist what needs to get swapped out and 
if you mess up that will be tough to debug as well.

Both get the same outcome but with different approaches, it's just a question 
of which one is easiest to maintain.

--

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



[issue14658] Overwriting dict.__getattr__ is inconsistent

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset e3eda2d91e93 by Benjamin Peterson in branch '2.7':
don't use a slot wrapper from a different special method (closes #14658)
http://hg.python.org/cpython/rev/e3eda2d91e93

--

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



[issue11603] Python crashes or hangs when rebinding __repr__ as __str__

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset e3eda2d91e93 by Benjamin Peterson in branch '2.7':
don't use a slot wrapper from a different special method (closes #14658)
http://hg.python.org/cpython/rev/e3eda2d91e93

--

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



[issue14605] Make import machinery explicit

2012-04-24 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

That initial comment is out-of-date. If you look that the commit I made I  
documented importlib.machinery._SourcelessFileLoader. I am continuing the 
discouragement of using bytecode files as an obfuscation technique (because 
it's a bad one), but I decided to at least document the class so people can use 
it at their own peril and know about it if they happen to come across the 
object during execution.

--

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Le mardi 24 avril 2012 à 15:10 +, Brett Cannon a écrit :
 Both get the same outcome but with different approaches, it's just a
 question of which one is easiest to maintain.

I don't have any strong preference. Nick's proposal sounds slightly
better but Nick hasn't uploaded a patch yet :-)

--

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



[issue13934] sqlite3 test typo

2012-04-24 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

poq, would you like to also prepare a patch for the documentation with what 
Thomas suggested? I'd be happy to review when ready

--
nosy: +sandro.tosi

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



[issue1065986] Fix pydoc crashing on unicode strings

2012-04-24 Thread Stefano Taschini

Stefano Taschini tasch...@ieee.org added the comment:

Oh well, in that case I guess we'll have to work around it.

Here's the monkey patch I use to overcome this limitation in pydoc, in case 
others wish to add it to their PYTHONSTARTUP or sitecustomize:

def pipepager(text, cmd):
Page through text by feeding it to another program.
try:
import locale
except ImportError:
encoding = ascii
else:
encoding = locale.getpreferredencoding()
pipe = os.popen(cmd, 'w')
try:
pipe.write(text.encode(encoding, 'xmlcharrefreplace') if 
isinstance(text, unicode) else text)
pipe.close()
except IOError:
pass # Ignore broken pipes caused by quitting the pager program.
import pydoc
pydoc.pipepager = pipepager
del pydoc, pipepager

--

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



[issue14660] Implement PEP 420: Implicit Namespace Packages

2012-04-24 Thread Eric V. Smith

Eric V. Smith e...@trueblade.com added the comment:

I created the NamespaceLoader in the feature branch. It has a load_module, but 
it's only ever called by the code in PathFinder.load_module:

loader = NamespaceLoader(namespace_path)
return loader.load_module(fullname)

namespace_path is what will become module.__path__. In order to keep the 
load_module API (single fullname argument), I pass it in to the constructor. 
There's no particular need for it to follow that API, but it does.

--

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



[issue13903] New shared-keys dictionary implementation

2012-04-24 Thread Mark Shannon

Mark Shannon m...@hotpy.org added the comment:

Failed to differentiate between failure and error in make_split_table().

Patch attached

--
Added file: http://bugs.python.org/file25340/make_split_table_error.patch

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



[issue13587] Correcting the typos error in Doc/howto/urllib2.rst

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 4dda3000c932 by Sandro Tosi in branch '2.7':
Issue #13587: use the right RFC2617 name for WWW-Authenticate; patch by Aaron 
Maenpaa
http://hg.python.org/cpython/rev/4dda3000c932

New changeset 01abffa8842a by Sandro Tosi in branch '3.2':
Issue #13587: use the right RFC2617 name for WWW-Authenticate; patch by Aaron 
Maenpaa
http://hg.python.org/cpython/rev/01abffa8842a

New changeset 798b9714777d by Sandro Tosi in branch 'default':
Issue #13587: merge with 3.2
http://hg.python.org/cpython/rev/798b9714777d

--
nosy: +python-dev

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



[issue13587] Correcting the typos error in Doc/howto/urllib2.rst

2012-04-24 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

Aaron: thanks for the patch!

--
nosy: +sandro.tosi
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue14660] Implement PEP 420: Implicit Namespace Packages

2012-04-24 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Yeah, having to pass in the name to load_module is silly. I'm seriously 
considering making it optional for some loaders when the name was passed in to 
the constructor.

One thing I would like to see is that PathFinder take a new, keyword-only 
argument of 'namespace_loader' or something that takes an object which is 
called with the module name and the list of paths to use for __path__ (and thus 
__path__[0] becomes __file__). That way it can be controlled by users if 
desired. I'm also fine with it having a default value of NamespaceLoader to 
start since I don't see people needing to comprehend what they are allowing in 
this case as I do for general file loaders.

--

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



[issue13903] New shared-keys dictionary implementation

2012-04-24 Thread Giampaolo Rodola'

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


--
nosy:  -giampaolo.rodola

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



[issue13478] No documentation for timeit.default_timer

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 86b927859155 by Sandro Tosi in branch '2.7':
Issue #13478: document timeit.default_timer()
http://hg.python.org/cpython/rev/86b927859155

New changeset 8165b59a4000 by Sandro Tosi in branch '3.2':
Issue #13478: document timeit.default_timer()
http://hg.python.org/cpython/rev/8165b59a4000

New changeset e43ba06da592 by Sandro Tosi in branch 'default':
Issue #13478: merge with 3.2
http://hg.python.org/cpython/rev/e43ba06da592

--
nosy: +python-dev

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



[issue13478] No documentation for timeit.default_timer

2012-04-24 Thread Sandro Tosi

Changes by Sandro Tosi sandro.t...@gmail.com:


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

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



[issue1065986] Fix pydoc crashing on unicode strings

2012-04-24 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Hmm.  Making it not raise an error while still producing useful output would be 
acceptable as a bug fix if that's all it takes, I think.

--
status: closed - open

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



[issue14661] posix module: add O_EXEC, O_SEARCH, O_TTY_INIT

2012-04-24 Thread Pino Toscano

New submission from Pino Toscano toscano.p...@tiscali.it:

The posix module exposes already quite some O_* constants, but it misses few 
POSIX ones (see [1]), but it misses O_EXEC, O_SEARCH, and O_TTY_INIT.

The attached patch adds them.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html

--
files: fcntl_h_constants.diff
keywords: patch
messages: 159168
nosy: pino
priority: normal
severity: normal
status: open
title: posix module: add O_EXEC, O_SEARCH, O_TTY_INIT
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file25341/fcntl_h_constants.diff

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



[issue14554] test module: correction

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 22767284de99 by Sandro Tosi in branch '2.7':
Issue #14554: correct example for captured_stdout()
http://hg.python.org/cpython/rev/22767284de99

New changeset d1ba0421d65f by Sandro Tosi in branch '3.2':
Issue #14554: correct example for captured_stdout(); patch by Tshepang 
Lekhonkhobe
http://hg.python.org/cpython/rev/d1ba0421d65f

New changeset 6f41f8ed87c8 by Sandro Tosi in branch 'default':
Issue #14554: merge with 3.2
http://hg.python.org/cpython/rev/6f41f8ed87c8

--
nosy: +python-dev

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



[issue14554] test module: correction

2012-04-24 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

Thanks for the patch, Tshepang!

--
nosy: +sandro.tosi
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed

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



[issue14653] Improve mktime_tz to use calendar.timegm instead of time.mktime

2012-04-24 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I think that what is going to happen is that both of these functions are going 
to be deprecated in favor of functions that use datetimes.

That said, this might be a worthwhile as a bug fix.  I'm adding Alexander as 
nosy to see what he thinks.  (mktime_tz is located in email.utils, with the 
source in Lib/email/_parseaddr.py).

--
assignee:  - r.david.murray
nosy: +belopolsky, r.david.murray
versions: +Python 3.2, Python 3.3

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



[issue13903] New shared-keys dictionary implementation

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset b044e0568be2 by Martin v. Loewis in branch 'default':
Account for shared keys in type's __sizeof__ (#13903).
http://hg.python.org/cpython/rev/b044e0568be2

--

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

test me
thod. Another option is we hide the source as _importlib or something to allow 
direct importation w/o any tricks under a protected name.

Using the freeze everything approach you make things easier for the
implementation, since you don't have to think about whether certain
pieces of code are already available or not.

For development, you can also have the package load bytecode
or source from an external package instead of running (all of)
the module's bytecode that was compiled into the binary.

This is fairly easy to do, since the needed exec() does not
depend on the import machinery.

The only downside is big if statement to isolate the frozen
version from the loaded one - would be great if we had a
command to stop module execution or code execution for a block to
make that more elegant, e.g. break at module scope :-)

--

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



[issue14661] posix module: add O_EXEC, O_SEARCH, O_TTY_INIT

2012-04-24 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +neologix
stage:  - patch review

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



[issue14654] More fast utf-8 decoding

2012-04-24 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

Here are two new patches. The first one takes into account the Martin
wishes about comments. The second also rejects optimization for ASCII.

On the Intel Atom last patch annihilates acceleration for some cases
(mostly-ascii with UCS2 data):

  vanilla patch1  patch3

utf-8 'A'*+'\u0100'   124 (+8%)   288 (-53%)  134
utf-8 'A'*+'\u8000'   124 (+8%)   291 (-54%)  134
utf-8   '\u0100'+'A'* 78 (+5%)123 (-33%)  82
utf-8   '\u8000'+'A'* 78 (+5%)124 (-34%)  82

On the AMD Athlon there is no noticeable effect.

--
Added file: http://bugs.python.org/file25342/decode_utf8_2.patch
Added file: http://bugs.python.org/file25343/decode_utf8_3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14654
___diff -r c820aa9c0c00 Objects/stringlib/codecs.h
--- a/Objects/stringlib/codecs.hFri Apr 20 18:04:03 2012 -0400
+++ b/Objects/stringlib/codecs.hTue Apr 24 19:51:31 2012 +0300
@@ -21,7 +21,6 @@
const char **src_pos, Py_ssize_t *dest_index)
 {
 int ret;
-Py_ssize_t n;
 const char *s = start;
 const char *aligned_end = (const char *) ((size_t) end  ~LONG_PTR_MASK);
 STRINGLIB_CHAR *p = dest;
@@ -48,15 +47,33 @@
 unsigned long value = *(unsigned long *) _s;
 if (value  ASCII_CHAR_MASK)
 break;
-_p[0] = _s[0];
-_p[1] = _s[1];
-_p[2] = _s[2];
-_p[3] = _s[3];
-#if (SIZEOF_LONG == 8)
-_p[4] = _s[4];
-_p[5] = _s[5];
-_p[6] = _s[6];
-_p[7] = _s[7];
+#ifdef BYTEORDER_IS_LITTLE_ENDIAN
+_p[0] = (STRINGLIB_CHAR)(value  0xFFu);
+_p[1] = (STRINGLIB_CHAR)((value  8)  0xFFu);
+_p[2] = (STRINGLIB_CHAR)((value  16)  0xFFu);
+_p[3] = (STRINGLIB_CHAR)((value  24)  0xFFu);
+#if SIZEOF_LONG == 8
+_p[4] = (STRINGLIB_CHAR)((value  32)  0xFFu);
+_p[5] = (STRINGLIB_CHAR)((value  40)  0xFFu);
+_p[6] = (STRINGLIB_CHAR)((value  48)  0xFFu);
+_p[7] = (STRINGLIB_CHAR)((value  56)  0xFFu);
+#endif
+#else
+#if SIZEOF_LONG == 8
+_p[0] = (STRINGLIB_CHAR)((value  56)  0xFFu);
+_p[1] = (STRINGLIB_CHAR)((value  48)  0xFFu);
+_p[2] = (STRINGLIB_CHAR)((value  40)  0xFFu);
+_p[3] = (STRINGLIB_CHAR)((value  32)  0xFFu);
+_p[4] = (STRINGLIB_CHAR)((value  24)  0xFFu);
+_p[5] = (STRINGLIB_CHAR)((value  16)  0xFFu);
+_p[6] = (STRINGLIB_CHAR)((value  8)  0xFFu);
+_p[7] = (STRINGLIB_CHAR)(value  0xFFu);
+#else
+_p[0] = (STRINGLIB_CHAR)((value  24)  0xFFu);
+_p[1] = (STRINGLIB_CHAR)((value  16)  0xFFu);
+_p[2] = (STRINGLIB_CHAR)((value  8)  0xFFu);
+_p[3] = (STRINGLIB_CHAR)(value  0xFFu);
+#endif
 #endif
 _s += SIZEOF_LONG;
 _p += SIZEOF_LONG;
@@ -67,78 +84,114 @@
 break;
 ch = (unsigned char)*s;
 }
+if (ch  0x80) {
+s++;
+*p++ = ch;
+continue;
+}
 }
 
-if (ch  0x80) {
-s++;
+if (ch  0xC2) {
+/* invalid sequence
+   \x80-\xBF -- continuation byte
+   \xC0-\xC1 -- fake -007F */
+goto _error;
+}
+
+if (ch  0xE0) {
+/* \xC2\x80-\xDF\xBF -- 0080-07FF */
+Py_UCS4 ch2;
+if (end - s  2) {
+/* unexpected end of data: the caller will decide whether
+   it's an error or not */
+goto _error;
+}
+ch2 = (unsigned char)s[1];
+if ((ch2  0xc0) != 0x80)
+/* invalid continuation byte */
+goto _error;
+ch = (ch  6) + ch2 - 030200;
+assert ((ch  0x007F)  (ch = 0x07FF));
+s += 2;
 *p++ = ch;
 continue;
 }
 
-n = utf8_code_length[ch];
-
-if (s + n  end) {
-/* unexpected end of data: the caller will decide whether
-   it's an error or not */
-goto _error;
-}
-
-switch (n) {
-case 0:
-/* invalid start byte */
-goto _error;
-case 1:
-/* internal error */
-goto _error;
-case 2:
-if ((s[1]  0xc0) != 0x80)
- 

[issue14448] Mention pytz in datetime's docs

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset e0e421133d0f by Sandro Tosi in branch '2.7':
Issue #14448: mention pytz; patch by Andrew Svetlov
http://hg.python.org/cpython/rev/e0e421133d0f

New changeset 3aec41794584 by Sandro Tosi in branch '3.2':
Issue #14448: mention pytz; patch by Andrew Svetlov
http://hg.python.org/cpython/rev/3aec41794584

New changeset b46fa7bc6710 by Sandro Tosi in branch 'default':
Issue #14448: merge with 3.2
http://hg.python.org/cpython/rev/b46fa7bc6710

--
nosy: +python-dev

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



[issue14448] Mention pytz in datetime's docs

2012-04-24 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

I've reworded a bit the patch: thanks for it, Andrew

--
nosy: +sandro.tosi
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue14605] Make import machinery explicit

2012-04-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Brett Cannon wrote:
 
 That initial comment is out-of-date. If you look that the commit I made I  
 documented importlib.machinery._SourcelessFileLoader. I am continuing the 
 discouragement of using bytecode files as an obfuscation technique (because 
 it's a bad one), but I decided to at least document the class so people can 
 use it at their own peril and know about it if they happen to come across the 
 object during execution.

It's not a perfect obfuscation technique, but a pretty simple and
(legally) effective one to use.

FWIW, I don't think the comment in the check-in is appropriate:


   1.127 +   It is **strongly** suggested you do not rely on this loader (hence 
the
   1.128 +   leading underscore of the class). Direct use of bytecode files 
(and thus not
   1.129 +   source code files) inhibits your modules from being usable by all 
Python
   1.130 +   implementations. It also runs the risk of your bytecode files not 
being
   1.131 +   usable by new versions of Python which change the bytecode format. 
This
   1.132 +   class is only documented as it is directly used by import and thus 
can
   1.133 +   potentially have instances show up as a module's ``__loader__`` 
attribute.


The risks you mention there are really up to the application developers
to decide how to handle, not the Python developers. Python has a long
tradition of being friendly to commercial applications and I don't see
any reason why we should stop that.

If you do want this to change, please write a PEP. This may appear
to be a small change in direction, but it does in fact have quite
some impact on the usefulness of CPython in commercial settings.

I also think that the SourcelessFileLoader loader should be first class
citizen without the leading underscore if the importlib is to completely
replace the current import mechanism. Why force developers to write their
own loader instead of using the standard one just because of the leading
underscore, when it's only 20 lines of code ?

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com


2012-04-28: PythonCamp 2012, Cologne, Germany   4 days to go

::: Try our new mxODBC.Connect Python Database Interface for free ! 

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--

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



[issue14662] shutil.move broken in 2.7.3 on OSX (chflags fails)

2012-04-24 Thread Fabian Groffen

New submission from Fabian Groffen grob...@gentoo.org:

With current working dir an NFS-mounted ZFS share, and /var/tmp (OSX default) 
HFS+:

% echo test  /var/tmp/testfile
% python
Python 2.7.3 (default, Apr 24 2012, 19:33:45) 
[GCC 4.2.1 (Gentoo 4.2.1_p5666, Apple Inc. build 5666) (dot 3)] on darwin
Type help, copyright, credits or license for more information.
 import shutil
 shutil.move(/var/tmp/testfile, ./testfile);
Traceback (most recent call last):
  File stdin, line 1, in module
  File /Library/Gentoo/usr/lib/python2.7/shutil.py, line 299, in move
copy2(src, real_dst)
  File /Library/Gentoo/usr/lib/python2.7/shutil.py, line 129, in copy2
copystat(src, dst)
  File /Library/Gentoo/usr/lib/python2.7/shutil.py, line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 45] Operation not supported: './testfile'
 
% ls /var/tmp/testfile ./testfile
./testfile  /var/tmp/testfile

The problem likely is that the flags stored on the HFS+ volume cannot be 
applied to the NFS-mounted ZFS volume.  This likely also occurs when doing a 
bit more regular things, like e.g. moving/copying to a mounted USB disk (with 
FAT32 filesystem).

I believe this is a regression introduced by 
http://bugs.python.org/issue8746.  Python-2.7.2 works fine.

While preserving flags is nice, it is questionable whether failure to do so in 
this case is worth dying for.  In particular, leaving behind both the original 
as well as the copy is a bit messy.

--
components: None
messages: 159178
nosy: grobian
priority: normal
severity: normal
status: open
title: shutil.move broken in 2.7.3 on OSX (chflags fails)
type: behavior
versions: Python 2.7

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



[issue5057] Unicode-width dependent optimization leads to non-portable pyc file

2012-04-24 Thread Armin Rigo

Armin Rigo ar...@users.sourceforge.net added the comment:

Sorry to re-open this issue.  The following example shows that it was not fully 
resolved:

def f():
return u'\U00023456abcdef'[3]
import dis; dis.dis(f)
print f()

On a wide build it should print 'c' and on a narrow build it should print 'b'.  
But if the .pyc file was created on the other platform, it behaves like the 
other platform would.

--
nosy: +arigo
resolution: fixed - 
stage: committed/rejected - needs patch
status: closed - open

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



[issue14663] Cannot comment out comments

2012-04-24 Thread Nul Character

New submission from Nul Character nulcharac...@gmail.com:

When attempting to comment out a comment and thus nullifying it, the 
interpreter just double comments the line. This behavior works with multiline 
comments, however, the single line comments double-comment the line.

--
components: Interpreter Core
files: comment.py
messages: 159180
nosy: nulchar
priority: normal
severity: normal
status: open
title: Cannot comment out comments
type: performance
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file25344/comment.py

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



[issue14663] Cannot comment out comments

2012-04-24 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

A comment is a comment.  *All* characters after the # are ignored, including 
other #s.

Also, Python doesn't have multiline comments.  (Well, you can use a triple 
quoted string as a multiline comment, but it is still a string, and follows the 
syntax rules of strings.)

--
nosy: +r.david.murray
resolution:  - invalid
stage:  - committed/rejected
status: open - closed
type: performance - behavior

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



[issue14369] make __closure__ writable

2012-04-24 Thread Richard Oudkerk

Richard Oudkerk shibt...@gmail.com added the comment:

Shouldn't test___closure__() also test what happens when the closure is 
replaced with None, or a tuple which is too long or too short or contains 
non-cell objects?

All of these things seem to be checked when you create a new function using 
types.FunctionType:

 h = types.FunctionType(g.__code__, g.__globals__, h, g.__defaults__, None)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: arg 5 (closure) must be tuple
 h = types.FunctionType(g.__code__, g.__globals__, h, g.__defaults__, ())
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: g requires closure of length 2, not 0
 h = types.FunctionType(g.__code__, g.__globals__, h, g.__defaults__, 
 (1,2))
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: arg 5 (closure) expected cell, found int

I think the setter should make similar checks.  Maybe there is C code which 
assumes broken closures never happen.

--
nosy: +sbt

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



[issue14661] posix module: add O_EXEC, O_SEARCH, O_TTY_INIT

2012-04-24 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

I will take care of this.

--
assignee:  - jcea
nosy: +jcea

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



[issue14662] shutil.move broken in 2.7.3 on OSX (chflags fails)

2012-04-24 Thread Hynek Schlawack

Hynek Schlawack h...@ox.cx added the comment:

I guess a “best effort” approach would be best here.

I presume Python 3.2+ have the same behavior?

--
nosy: +hynek

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



[issue14662] shutil.move broken in 2.7.3 on OSX (chflags fails)

2012-04-24 Thread Fabian Groffen

Fabian Groffen grob...@gentoo.org added the comment:

 I presume Python 3.2+ have the same behavior?

I cannot compile that or get it working normally, so I can't tell for sure.  
Judging from the code, I'd say yes.

--

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

 would be great if we had a
 command to stop module execution or code execution for a block to
 make that more elegant, e.g. break at module scope :-)

I floated that proposal on python-list a while back and the reaction was mixed. 
[1]  Maybe it's time to try again.  (moving over to python-ideas...)

[1] http://mail.python.org/pipermail/python-list/2011-June/1274424.html

--

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



[issue14610] configure script hangs on pthread verification and PTHREAD_SCOPE_SYSTEM verification on Ubuntu

2012-04-24 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Your strace output looks strange :-)
Unless it's truncated, we see that the wait4() doesn't return when the
test pthread executable exits...

Could you try building this code :

#include pthread.h

void* routine(void* p){return NULL;}

int main(){
  pthread_t p;
  if(pthread_create(p,NULL,routine,NULL)!=0)
return 1;
  (void)pthread_detach(p);
  return 0;
}


(with gcc -o test test.c -lpthread)

And running it from the command line, to see your shell hangs (you
might also want to try 'strace -f sh -c test').

--

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



[issue13903] New shared-keys dictionary implementation

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 5d5b72a71898 by Benjamin Peterson in branch 'default':
distiguish between refusing to creating shared keys and error (#13903)
http://hg.python.org/cpython/rev/5d5b72a71898

--

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



[issue14661] posix module: add O_EXEC, O_SEARCH, O_TTY_INIT

2012-04-24 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

I add some other constants too.

--

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



[issue14632] Race condition in WatchedFileHandler leads to unhandled exception

2012-04-24 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 I can't see why this always works, while John's script sometimes fails.

It does fail consistently on my machine.
I'm attaching the diff just in case.

--
Added file: http://bugs.python.org/file25345/test_logging_race.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14632
___diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -33,6 +33,7 @@
 import json
 import os
 import queue
+import random
 import re
 import select
 import socket
@@ -527,6 +528,39 @@
 self.assertEqual(h.name, 'anothergeneric')
 self.assertRaises(NotImplementedError, h.emit, None)
 
+@unittest.skipUnless(threading, 'Threading required for this test.')
+def test_race(self):
+# Issue #14632 refers.
+def remove_loop(fname, tries):
+for _ in range(tries):
+try:
+os.unlink(fname)
+except OSError:
+pass
+time.sleep(0.004 * random.randint(0, 4))
+
+def cleanup(remover, fn, handler):
+handler.close()
+remover.join()
+if os.path.exists(fn):
+os.unlink(fn)
+
+fd, fn = tempfile.mkstemp('.log', 'test_logging-3-')
+os.close(fd)
+del_count = 1000
+log_count = 1000
+remover = threading.Thread(target=remove_loop, args=(fn, del_count))
+remover.daemon = True
+remover.start()
+h = logging.handlers.WatchedFileHandler(fn)
+self.addCleanup(cleanup, remover, fn, h)
+f = logging.Formatter('%(asctime)s: %(levelname)s: %(message)s')
+h.setFormatter(f)
+for _ in range(log_count):
+time.sleep(0.005)
+r = logging.makeLogRecord({'msg': 'testing' })
+h.handle(r)
+
 def test_builtin_handlers(self):
 # We can't actually *use* too many handlers in the tests,
 # but we can try instantiating them with various options
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14661] posix module: add O_EXEC, O_SEARCH, O_TTY_INIT

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 34de406f566d by Jesus Cea in branch 'default':
Issue #14661: posix module: add O_EXEC, O_SEARCH, O_TTY_INIT
http://hg.python.org/cpython/rev/34de406f566d

New changeset 2023f48b32b6 by Jesus Cea in branch 'default':
Closes Issue #14661: posix module: add O_EXEC, O_SEARCH, O_TTY_INIT (I add some 
Solaris constants too)
http://hg.python.org/cpython/rev/2023f48b32b6

--
nosy: +python-dev

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



[issue14661] posix module: add O_EXEC, O_SEARCH, O_TTY_INIT

2012-04-24 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


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

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



[issue14662] shutil.move broken in 2.7.3 on OSX (chflags fails)

2012-04-24 Thread Hynek Schlawack

Hynek Schlawack h...@ox.cx added the comment:

Now that’s odd. I just looked into the code at 
http://hg.python.org/cpython/file/2.7/Lib/shutil.py#l103 and there is a guard 
against EOPNOTSUPP:

try:
   os.chflags(dst, st.st_flags)
except OSError, why:
   if (not hasattr(errno, 'EOPNOTSUPP') or
   why.errno != errno.EOPNOTSUPP):
  raise

Does your /Library/Gentoo/usr/lib/python2.7/shutil.py look the same? Would you 
mind adding a `print why.errno` just before the raise?

I have tried move'ing files to NTFS and FAT32 and it works just fine here.

--

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



[issue14160] TarFile.extractfile fails to extract targets of top-level relative symlinks

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 0adf4fd8df83 by Lars Gustäbel in branch '3.2':
Issue #14160: TarFile.extractfile() failed to resolve symbolic links
http://hg.python.org/cpython/rev/0adf4fd8df83

New changeset 38df99776901 by Lars Gustäbel in branch 'default':
Merge with 3.2: Issue #14160: TarFile.extractfile() failed to resolve symbolic
http://hg.python.org/cpython/rev/38df99776901

--
nosy: +python-dev

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



[issue14656] Add a macro for unreachable code

2012-04-24 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Let me explain what I meant with code.

--
keywords: +patch
Added file: http://bugs.python.org/file25346/unreachable.patch

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



[issue14605] Make import machinery explicit

2012-04-24 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

I documented it explicitly so people can use it if they so choose (e.g. look at 
sys._getframe()). If you want to change this that's fine, but I am personally 
not going to put the effort in to rename the class, update the tests, and 
change the docs for this (we almost stopped allowing the importation of 
bytecode directly not so long ago but got push-back so we backed off).

--

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

I don't quite follow what you are suggesting, MAL. Are you saying to freeze 
importlib.__init__ and importlib._bootstrap and somehow have improtlib.__init__ 
choose what to load, frozen or source?

--

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2012-04-24 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


Added file: http://bugs.python.org/file25347/34103049559f.diff

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2012-04-24 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


Removed file: http://bugs.python.org/file25347/34103049559f.diff

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2012-04-24 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


Added file: http://bugs.python.org/file25348/0a5a40a4674a.diff

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2012-04-24 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

New version, addressing Amaury concerns and Neologix review.

Please, do a final review.

--

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Brett Cannon wrote:
 
 Brett Cannon br...@python.org added the comment:
 
 I don't quite follow what you are suggesting, MAL. Are you saying to freeze 
 importlib.__init__ and importlib._bootstrap and somehow have 
 improtlib.__init__ choose what to load, frozen or source?

No, it always loads and runs the frozen code, but at the start of
the module code it branches between the frozen bytecode and the code
read from an external file.

Pseudo-code in every module you wish to be able to host externally:

#
# MyModule
#
if operating_in_dev_mode and 'frozen' in __file__:
exec(open('dev-area/MyModule.py', 'r).read(), globals(), globals())
else:
# Normal module code
class MyClass: ...
# hundreds of lines of code...

Aside: With a module scope break, the code would look more elegant:

#
# MyModule
#
if operating_in_dev_mode and 'frozen' in __file__:
exec(open('dev-area/MyModule.py', 'r).read(), globals(), globals())
break

# Normal module code
class MyClass: ...
# hundreds of lines of code...

--

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2012-04-24 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

- In test_posix.py: it's better to use the with statement when opening a file
- In Misc/NEWS: the entries should be kept in reverse chronological order

--

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



[issue1522400] irda socket support

2012-04-24 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Here's a cleanup up patch against default.
However, I don't have any IrDA capable device neither, so I won't be
able to help much. I'll ask on python-dev if someone can help.
As for the manual decoding, AFAICT you'll have the same issue with CAN sockets.
The real question is really how high-level should the socket module be?.
Because if we added let's say and IRDASocket type, then we could
easily add helper functions to and methods to e.g. list available IrDA
devices, decode fields, etc.
Same thing holds for CAN sockets, and one could imagine we could also
maybe add a MulticastSocket that would make joining/leaving a
multicast group easy (because it is a pain), etc.

--
Added file: http://bugs.python.org/file25349/irda-default.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1522400
___diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1262,6 +1262,16 @@
 }
 #endif
 
+#ifdef AF_IRDA
+case AF_IRDA:
+{
+struct sockaddr_irda *a = (struct sockaddr_irda *)addr;
+
+return Py_BuildValue(iO, a-sir_addr,
+PyUnicode_DecodeFSDefault, a-sir_name);
+}
+#endif
+
 /* More cases here... */
 
 default:
@@ -1759,6 +1769,47 @@
 }
 #endif
 
+#ifdef HAVE_IRDA_H
+case AF_IRDA:
+{
+struct sockaddr_irda *addr;
+int daddr;
+PyObject *service;
+addr = (struct sockaddr_irda *)addr_ret;
+Py_ssize_t len;
+
+if (!PyArg_ParseTuple(args, iO, daddr,
+   PyUnicode_FSConverter, service))
+return 0;
+
+len = PyBytes_GET_SIZE(service);
+
+if (len = 0 || len = sizeof(addr-sir_name)) {
+PyErr_SetString(PyExc_OSError, AF_IRDA service name too long);
+Py_DECREF(service);
+return 0;
+}
+
+#ifdef HAVE_LINUX_IRDA_H
+addr-sir_family = AF_IRDA;
+addr-sir_lsap_sel = LSAP_ANY;
+addr-sir_addr = daddr;
+strcpy(addr-sir_name, PyBytes_AS_STRING(service));
+#else /* Windows */
+addr-irdaAddressFamily = AF_IRDA;
+addr-irdaDeviceID[0] = (daddr  24)  Oxff;
+addr-irdaDeviceID[1] = (daddr  16)  Oxff;
+addr-irdaDeviceID[2] = (daddr  8)  Oxff;
+addr-irdaDeviceID[3] = daddr  Oxff;
+strcpy(addr-irdaServiceName, PyBytes_AS_STRING(service));
+#endif
+
+Py_DECREF(service);
+*len_ret = sizeof(*addr);
+return 1;
+}
+#endif
+
 /* More cases here... */
 
 default:
@@ -1880,6 +1931,14 @@
 }
 #endif
 
+#ifdef AF_IRDA
+case AF_IRDA:
+{
+*len_ret = sizeof (struct sockaddr_irda);
+return 1;
+}
+#endif
+ 
 /* More cases here... */
 
 default:
@@ -5823,6 +5882,14 @@
 PyModule_AddIntConstant(m, AF_SYSTEM, AF_SYSTEM);
 #endif
 
+/* Infrared Data Association */
+#ifdef AF_IRDA
+PyModule_AddIntConstant(m, AF_IRDA, AF_IRDA);
+#endif
+#ifdef PF_IRDA
+PyModule_AddIntConstant(m, PF_IRDA, PF_IRDA);
+#endif
+
 #ifdef AF_PACKET
 PyModule_AddIntMacro(m, AF_PACKET);
 #endif
@@ -5895,6 +5962,13 @@
 PyModule_AddIntConstant(m, TIPC_TOP_SRV, TIPC_TOP_SRV);
 #endif
 
+#ifdef HAVE_IRDA_H
+PyModule_AddIntConstant(m, SOL_IRLMP, SOL_IRLMP);
+PyModule_AddIntConstant(m, IRLMP_ENUMDEVICES, IRLMP_ENUMDEVICES);
+PyModule_AddIntConstant(m, IRLMP_IAS_SET, IRLMP_IAS_SET);
+PyModule_AddIntConstant(m, IRLMP_IAS_QUERY, IRLMP_IAS_QUERY);
+#endif
+
 /* Socket types */
 PyModule_AddIntConstant(m, SOCK_STREAM, SOCK_STREAM);
 PyModule_AddIntConstant(m, SOCK_DGRAM, SOCK_DGRAM);
diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h
--- a/Modules/socketmodule.h
+++ b/Modules/socketmodule.h
@@ -87,6 +87,17 @@
 #include sys/kern_control.h
 #endif
 
+#if (defined(MS_WINDOWS) || defined(HAVE_LINUX_IRDA_H))
+#define HAVE_IRDA_H
+#ifdef HAVE_LINUX_IRDA_H
+#include linux/types.h
+#include linux/irda.h
+#else
+#include af_irda.h
+#define sockaddr_irda _SOCKADDR_IRDA
+#endif
+#endif
+
 #ifndef Py__SOCKET_H
 #define Py__SOCKET_H
 #ifdef __cplusplus
@@ -148,6 +159,9 @@
 #ifdef HAVE_SYS_KERN_CONTROL_H
 struct sockaddr_ctl ctl;
 #endif
+#ifdef HAVE_IRDA_H
+struct sockaddr_irda ir;
+#endif
 } sock_addr_t;
 
 /* The object holding a socket.  It holds some extra information,
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -6605,6 +6605,25 @@
 done
 
 
+# On Linux, irda.h requires sys/socket.h
+for ac_header in linux/irda.h
+do :
+  ac_fn_c_check_header_compile $LINENO linux/irda.h 
ac_cv_header_linux_irda_h 
+#ifdef HAVE_SYS_SOCKET_H
+#include sys/socket.h
+#endif
+
+
+if test x$ac_cv_header_linux_irda_h = xyes; then :
+  cat confdefs.h _ACEOF
+#define HAVE_LINUX_IRDA_H 1
+_ACEOF
+
+fi
+
+done
+
+
 # checks 

[issue10142] Support for SEEK_HOLE/SEEK_DATA

2012-04-24 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


Added file: http://bugs.python.org/file25350/ad882ba08568.diff

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2012-04-24 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

Another version, after Antoine feedback.

Please, review.

--

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

So basically if you are running in a checkout, grab the source file and compile 
it manually since its location is essentially hard-coded and thus you don't 
need to care about sys.path and all the other stuff required to do an import, 
while using the frozen code for when you are running an installed module since 
you would otherwise need to do the search for importlib's source file to do a 
load at startup properly.

That's an interesting idea. How do we currently tell that the interpreter is 
running in a checkout? Is that exposed in any way to Python code?

--

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 That's an interesting idea. How do we currently tell that the
 interpreter is running in a checkout? Is that exposed in any way to
 Python code?

Look for _BUILDDIR_COOKIE in setup.py. But that's only for non-Windows
platforms (I don't think setup.py is invoked under Windows).

--

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



[issue14160] TarFile.extractfile fails to extract targets of top-level relative symlinks

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset aff14bea5596 by Lars Gustäbel in branch '2.7':
Issue #14160: TarFile.extractfile() failed to resolve symbolic links when
http://hg.python.org/cpython/rev/aff14bea5596

--

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



[issue14657] Avoid two importlib copies

2012-04-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Brett Cannon wrote:
 
 Brett Cannon br...@python.org added the comment:
 
 So basically if you are running in a checkout, grab the source file and 
 compile it manually since its location is essentially hard-coded and thus you 
 don't need to care about sys.path and all the other stuff required to do an 
 import, while using the frozen code for when you are running an installed 
 module since you would otherwise need to do the search for importlib's source 
 file to do a load at startup properly.

Right.

 That's an interesting idea. How do we currently tell that the interpreter is 
 running in a checkout? Is that exposed in any way to Python code?

There's some magic happening in site.py for checkouts, but I'm not sure
whether any of that is persistent or even available at the time these
particular imports would happen.

Then again, I'm not sure you need to know whether you have a checkout
or not. You just need some flag to identify whether you want the
search for external module code to take place or not. sys.flags
could be used for that.

--

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



[issue14160] TarFile.extractfile fails to extract targets of top-level relative symlinks

2012-04-24 Thread Lars Gustäbel

Lars Gustäbel l...@gustaebel.de added the comment:

Fixed. Thanks for the report.

--
resolution:  - fixed
status: open - closed

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



[issue4892] Sending Connection-objects over multiprocessing connections fails

2012-04-24 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 08d4c2fe51ea by Antoine Pitrou in branch 'default':
Issue #4892: multiprocessing Connections can now be transferred over 
multiprocessing Connections.
http://hg.python.org/cpython/rev/08d4c2fe51ea

--
nosy: +python-dev

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



  1   2   >