[issue6785] IncompleteRead / BadStatus when parsing http://peakoil.mobi

2009-08-26 Thread Evan

New submission from Evan :

(I'm brand new to Python.org, apologies in advance if this has been
recorded elsewhere or is not a bug)

I've a simple script which fetching a url using httplib/urllib2 and then
simply searches the HTML for a string. Works on every URL I've tried
apart from the url http://peakoil.mobi where, for some reason, I get the
following:

Traceback (most recent call last):
  File "C:\Python26\lib\threading.py", line 524, in __bootstrap_inner
self.run()
  File "test.py", line 59, in run
html = response.read()
  File "C:\Python26\lib\socket.py", line 327, in read
data = self._sock.recv(rbufsize)
  File "C:\Python26\lib\httplib.py", line 518, in read
return self._read_chunked(amt)
  File "C:\Python26\lib\httplib.py", line 564, in _read_chunked
raise IncompleteRead(value)
IncompleteRead: 




http://peakoil.com/modules.php?name=AvantGo"; name=mainwindow
framebo
rder=no framespacing=0 marginheight=0 marginwidth=0>


Your browser does not support frames.  We recommend upgrading your
browser.<
/h2>
Click http://peakoil.com/modules.php?name=AvantGo";>here to
enter the site.


Exception in thread 1:
Traceback (most recent call last):
  File "C:\Python26\lib\threading.py", line 524, in __bootstrap_inner
self.run()
  File "test.py", line 51, in run
response = urllib2.urlopen(req)
  File "C:\Python26\lib\urllib2.py", line 124, in urlopen
return _opener.open(url, data, timeout)
  File "C:\Python26\lib\urllib2.py", line 383, in open
response = self._open(req, data)
  File "C:\Python26\lib\urllib2.py", line 401, in _open
'_open', req)
  File "C:\Python26\lib\urllib2.py", line 361, in _call_chain
result = func(*args)
  File "C:\Python26\lib\urllib2.py", line 1130, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File "C:\Python26\lib\urllib2.py", line 1103, in do_open
r = h.getresponse()
  File "C:\Python26\lib\httplib.py", line 951, in getresponse
response.begin()
  File "C:\Python26\lib\httplib.py", line 391, in begin
version, status, reason = self._read_status()
  File "C:\Python26\lib\httplib.py", line 355, in _read_status
raise BadStatusLine(line)
BadStatusLine

--
messages: 91972
nosy: kmoon
severity: normal
status: open
title: IncompleteRead / BadStatus when parsing http://peakoil.mobi
type: behavior
versions: Python 2.6

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



[issue6825] Minor documentation bug with os.path.split

2010-10-07 Thread Evan Driscoll

Evan Driscoll  added the comment:

Hah, I totally forgot about this thing.

I'd suggest a change to the proposed patch. The patched version says:

  "In nearly all cases, ``join(head, tail)`` returns a location
   equivalent to *path* (the only exception being when there were 
   multiple slashes separating *head* from *tail*)."

Except now the parenthetical remark at the end of that sentence is a bit weird, 
because "a//a" != "a/a" is no longer an exception.

I'd suggest a wording such as one of the following, depending on where you want 
the emphasis (on the meaning of the return value of a path or on the actual 
contents of the return value as a string):

  "In all cases, ``join(head, tail)`` returns a location equivalent
   to *path*."

  "In most cases, ``join(head, tail)`` equals *path*; the
   exceptions to this are when there were multiple slashes
   separating *head* from *tail* or when *os.altsep* separators
   are replaced by *os.sep*."

The first suggestion could be followed by a remark "(but the strings may be 
unequal)" if you'd like.

I'd also replace "a location equivalent to" with "a path to the same location 
as" or something like that; "location" doesn't appear anywhere else on that 
page, and it seems slightly out of place to me.

--

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



[issue11513] chained exception/incorrect exception from tarfile.open on a non-existent file

2011-03-18 Thread Evan Dandrea

Evan Dandrea  added the comment:

David,

Thanks for the pointers. I've updated the patch hopefully adequately addressing 
your concerns.

--
components: +Interpreter Core -Library (Lib)
type: behavior -> 
Added file: 
http://bugs.python.org/file21277/tarfile-fix-multiple-exception-on-enoent.patch

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



[issue11513] chained exception/incorrect exception from tarfile.open on a non-existent file

2011-03-18 Thread Evan Dandrea

Changes by Evan Dandrea :


Removed file: 
http://bugs.python.org/file21223/tarfile-fix-multiple-exception-on-enoent.patch

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



[issue11503] Expand test coverage in posixpath

2011-03-14 Thread Evan Dandrea

New submission from Evan Dandrea :

I've expanded the coverage of the posixpath test.  The following scenarios have 
been added:
 - lexists with a non-existent file.
 - ismount with binary data.
 - ismount with a directory that is not a mountpoint.
 - ismount with a non-existent file.
 - ismount with a symlink.
 - expanduser with $HOME unset.
 - realpath with a relative path.
 - sameopenfile with a basic test.

I have tested it on Ubuntu natty (20110311) and Mac OSX 10.6.6.

--
components: Tests
files: test_posixpath.patch
keywords: patch
messages: 130856
nosy: ev
priority: normal
severity: normal
status: open
title: Expand test coverage in posixpath
type: behavior
Added file: http://bugs.python.org/file21122/test_posixpath.patch

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



[issue11503] Expand test coverage in posixpath

2011-03-14 Thread Evan Dandrea

Changes by Evan Dandrea :


--
nosy: +michael.foord

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



[issue11503] Expand test coverage in posixpath

2011-03-14 Thread Evan Dandrea

Evan Dandrea  added the comment:

Fixed a typo in the previous patch.

--
Added file: http://bugs.python.org/file21124/test_posixpath.patch

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



[issue11503] Expand test coverage in posixpath

2011-03-14 Thread Evan Dandrea

Evan Dandrea  added the comment:

Added an updated patch that includes testing whether ismount would succeed by 
faking path being on a different device from its parent.

--
Added file: 
http://bugs.python.org/file21125/test_posixpath_with_same_device.patch

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



[issue11503] Expand test coverage in posixpath

2011-03-14 Thread Evan Dandrea

Evan Dandrea  added the comment:

It's probably best to give the fake stats inode numbers, so if the code does 
fail to check the st_dev fields, it will fail the test.  I've updated the patch 
with this.

--
Added file: 
http://bugs.python.org/file21128/test_posixpath_with_same_device.patch

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



[issue11513] Infinite recursion around raising an exception in tarfile

2011-03-14 Thread Evan Dandrea

New submission from Evan Dandrea :

Using Python tip from Sunday, I noticed that tarfile does not elegantly handle 
ENOENT by raising a single exception:

>>> tarfile.TarFile.gzopen('fdsfd', 'r')
Traceback (most recent call last):
  File "/home/evan/hg/cpython/Lib/tarfile.py", line 1808, in gzopen
fileobj = gzip.GzipFile(name, mode + "b", compresslevel, fileobj)
  File "/home/evan/hg/cpython/Lib/gzip.py", line 157, in __init__
fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
IOError: [Errno 2] No such file or directory: 'fdsfd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "/home/evan/hg/cpython/Lib/tarfile.py", line 1812, in gzopen
fileobj.close()
AttributeError: 'NoneType' object has no attribute 'close'

I tried to fix this in a cross-platform way, by attempting to open the file 
before processing it, and letting the with statement handle calling close:

diff -r 955547e57cff Lib/tarfile.py
--- a/Lib/tarfile.pySun Mar 13 19:32:21 2011 +0100
+++ b/Lib/tarfile.pyMon Mar 14 19:33:21 2011 -0400
@@ -1793,6 +1793,10 @@
 if len(mode) > 1 or mode not in "rw":
 raise ValueError("mode must be 'r' or 'w'")
 
+if mode == "r":
+# force an exception if the file does not exist.
+    with open(name):
+pass
 try:
 import gzip
 gzip.GzipFile

However, this produces infinite recursion:
...
  File "/home/evan/hg/cpython/Lib/tarfile.py", line 1738, in open
return func(name, "r", fileobj, **kwargs)
  File "/home/evan/hg/cpython/Lib/tarfile.py", line 1798, in gzopen
with open(name):
  File "/home/evan/hg/cpython/Lib/tarfile.py", line 1738, in open
return func(name, "r", fileobj, **kwargs)
RuntimeError: maximum recursion depth exceeded

Curiously, if I force the ValueError in that same function to be triggered (by 
passing a three character string for the mode), that exception is raised fine.  
I am therefore wondering if this is a bug in the exit processing.

Unfortunately, my attempts at producing a general test case have been 
unsuccessful thusfar.

--
components: Interpreter Core
messages: 130932
nosy: ev
priority: normal
severity: normal
status: open
title: Infinite recursion around raising an exception in tarfile

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



[issue11548] Passing format= to unpack_archive fails

2011-03-14 Thread Evan Dandrea

New submission from Evan Dandrea :

Passing the format keyword parameter to shutil.unpack_archive triggers an 
exception:

Traceback (most recent call last):
  File "Lib/test/test_shutil.py", line 650, in test_unpack_archive
unpack_archive(filename, tmpdir2, format=format)
  File "/home/evan/hg/cpython/Lib/shutil.py", line 741, in unpack_archive
func(filename, extract_dir, **dict(format_info[1]))
TypeError: 'function' object is not iterable

This is due to that function incorrectly using the _UNPACK_FORMATS dictionary, 
which is fixed with the attached patch and test case.

--
components: Library (Lib)
files: fix_unpack_with_format.patch
keywords: patch
messages: 130948
nosy: ev, tarek
priority: normal
severity: normal
status: open
title: Passing format= to unpack_archive fails
type: crash
Added file: http://bugs.python.org/file21196/fix_unpack_with_format.patch

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



[issue11503] Expand test coverage in posixpath

2011-03-15 Thread Evan Dandrea

Evan Dandrea  added the comment:

Updated the patch to address Michael's concerns.

--
Added file: 
http://bugs.python.org/file21221/test_posixpath_with_same_device.patch

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



[issue11503] Expand test coverage in posixpath

2011-03-15 Thread Evan Dandrea

Evan Dandrea  added the comment:

I've looked at the sameopenfile code, and can see no reason why it would not 
work on Windows.  I've asked Brian to verify this.

--

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



[issue11503] Expand test coverage in posixpath

2011-03-15 Thread Evan Dandrea

Evan Dandrea  added the comment:

I haven't used addCleanup here, but have noted it for the future.  In this 
case, using it would require adding another function to handle the 
reassignment, which I think is a bit more messy than the extra bit of 
indentation.

--

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



[issue11513] Infinite recursion around raising an exception in tarfile

2011-03-15 Thread Evan Dandrea

Evan Dandrea  added the comment:

*facepalm* Indeed, thanks for pointing that out and nice catch on the race 
condition.  Attached is a patch to fix the issue as you've suggested, and adds 
a test case for it.

--
keywords: +patch
Added file: 
http://bugs.python.org/file21222/tarfile-fix-multiple-exception-on-enoent.patch

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



[issue11513] Infinite recursion around raising an exception in tarfile

2011-03-15 Thread Evan Dandrea

Changes by Evan Dandrea :


Added file: 
http://bugs.python.org/file21223/tarfile-fix-multiple-exception-on-enoent.patch

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



[issue11513] Infinite recursion around raising an exception in tarfile

2011-03-15 Thread Evan Dandrea

Changes by Evan Dandrea :


Removed file: 
http://bugs.python.org/file21222/tarfile-fix-multiple-exception-on-enoent.patch

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



[issue11548] Passing format= to unpack_archive fails

2011-03-15 Thread Evan Dandrea

Changes by Evan Dandrea :


Added file: http://bugs.python.org/file21228/fix_unpack_with_format.patch

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



[issue11548] Passing format= to unpack_archive fails

2011-03-15 Thread Evan Dandrea

Changes by Evan Dandrea :


Removed file: http://bugs.python.org/file21196/fix_unpack_with_format.patch

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



[issue11560] Expand test coverage in shutil

2011-03-15 Thread Evan Dandrea

New submission from Evan Dandrea :

The attached patch increases the coverage in shutil.  It makes the following 
changes:
 - Tests the code paths for file and directory copies across filesystems by 
mocking out rename.
 - Adds a test for shutil.copy.
 - Adds a test for shutil.copy2.
 - Tests shutil.unpack_archive with the format specified.
 - Tests the code path for creating the target directory in _make_tarball.

I have tested this on Ubuntu natty and OSX 10.6.6.  Note that this will fail 
until http://bugs.python.org/issue11548 is applied.

--
components: Tests
files: increase_test_shutil_coverage.patch
keywords: patch
messages: 131041
nosy: ev, tarek
priority: normal
severity: normal
status: open
title: Expand test coverage in shutil
Added file: http://bugs.python.org/file21229/increase_test_shutil_coverage.patch

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



[issue1043134] Add preferred extensions for MIME types

2012-10-10 Thread Evan Jones

Changes by Evan Jones :


--
nosy: +evanj

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



[issue4696] email module does not unfold headers

2012-10-10 Thread Evan Jones

Changes by Evan Jones :


--
nosy: +evanj

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



[issue6123] tarfile:

2009-05-27 Thread Evan Jones

New submission from Evan Jones :

tarfile.open() with an empty tar archive fails with a ReadError
exception. GNU tar refuses to create empty archives, but tarfile allows
it. See the following code which reproduces the error. I used the
version of tarfile.py from subversion (revision 72458) with Python 2.5
on Linux.

Exception:

Traceback (most recent call last):
  File "test.py", line 15, in 
tar = tarfile.open(fileobj=data)
  File "/home/evanj/taskmgr/tarfile.py", line 1649, in open
raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully

The problem seems to be that when TarFile.next() is called, it raises
the following exception for the empty tar file:

  File "/home/evanj/taskmgr/tarfile.py", line 2310, in next
tarinfo = self.tarinfo.fromtarfile(self)
  File "/home/evanj/taskmgr/tarfile.py", line 1235, in fromtarfile
obj = cls.frombuf(buf)
  File "/home/evanj/taskmgr/tarfile.py", line 1190, in frombuf
raise HeaderError("empty header")


The attached patch works for me, but no guarantees that it doesn't cause
other problems!


Sample code:

import cStringIO
import tarfile

# Create an empty tar file
data = cStringIO.StringIO()
tar = tarfile.open(mode="w", fileobj=data)
tar.close()
print "empty tar file; length:", len(data.getvalue())

# Open the tar file
data.seek(0)
tar = tarfile.open(fileobj=data)
print tar

--
components: Extension Modules
files: tarfile-empty.diff
keywords: patch
messages: 88416
nosy: ev...@mit.edu
severity: normal
status: open
title: tarfile:
type: behavior
Added file: http://bugs.python.org/file14093/tarfile-empty.diff

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



[issue6123] tarfile: opening an empty tar file fails

2009-05-27 Thread Evan Jones

Changes by Evan Jones :


--
title: tarfile: -> tarfile: opening an empty tar file fails

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



[issue6081] str.format_from_mapping()

2009-06-01 Thread Evan Behar

Changes by Evan Behar :


--
nosy: +ebehar

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



[issue6154] Python 3.1 rc1 will not build on OS X 10.5.7

2009-06-02 Thread Evan Behar

Evan Behar  added the comment:

I think I've found the problem.

In configure:

  13830 if test "${ac_cv_lib_intl_textdomain+set}" = set; then
  13831   echo $ECHO_N "(cached) $ECHO_C" >&6
  13832 else
  13833   ac_check_lib_save_LIBS=$LIBS
  13834 LIBS="-lintl  $LIBS"

but then 

  13883 rm -f core conftest.err conftest.$ac_objext
conftest_ipa8_conftest.oo \
  13884   conftest$ac_exeext conftest.$ac_ext
  13885 LIBS=$ac_check_lib_save_LIBS

ac_check_lib_save_LIBS is assigned before -lintl is added to LIBS, and
then LIBS is unconditionally re-assigned to ac_check_lib_save_LIBS a
little bit further down, which then doesn't have -lintl in it.

I've included a patch that changes this to be:

  ...

  13880 ac_cv_lib_intl_textdomain=no
  13881 LIBS=$ac_check_lib_save_LIBS
  13882 fi
  13883 
  13884 rm -f core conftest.err conftest.$ac_objext
conftest_ipa8_conftest.oo \
  13885   conftest$ac_exeext conftest.$ac_ext
  13886 fi

So that LIBS is only restored to the saved state if the check fails.

I'm not sure if mucking with the configure file directly is a great
idea, but this was the simplest thing I could think of that would work.

--
nosy: +ebehar
Added file: http://bugs.python.org/file14160/configure_lintl.patch

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



[issue6154] Python 3.1 rc1 will not build on OS X 10.5.7

2009-06-02 Thread Evan Behar

Evan Behar  added the comment:

I applied Benjamin's new patch to the original files, but I receive the
same error, and the LIBS in the Makefile still only has -ldl and not -lintl.

--

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



[issue6154] Python 3.1 rc1 will not build on OS X 10.5.7

2009-06-02 Thread Evan Behar

Evan Behar  added the comment:

It works fine for my framework build on 10.4.11

--

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



[issue6154] Python 3.1 rc1 will not build on OS X 10.5.7

2009-06-03 Thread Evan Behar

Evan Behar  added the comment:

Nevermind, my bad.  With Brett's patch, the build does not work with
--enable-framework

It appears that configure.in makes no assignment to FRAMEWORKLINK or
AC_SUBST call with it, and so it is deposited in the final Makefile
verbatim as @FRAMEWORKLINK@

If --enable-framework is defined, then this compiler command in
Makefile.pre:461 gets executed:

$(CC) -o $(LDLIBRARY)  -dynamiclib \
-isysroot "${UNIVERSALSDK}" \
-all_load $(LIBRARY) -Wl,-single_module \
-install_name
$(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
\
-compatibility_version $(VERSION) \
-current_version $(VERSION) \
$(FRAMEWORKLINK);

Which expands $(FRAMEWORKLINK) to @FRAMEWORKLINK@ because of this.

This makes no use of LIBS or any other environment variable that might
contain -lintl or -framework CoreFoundation, and the build will fail
with linker errors citing undefined intl and CFString symbols.

Attached is a patch that fixes this issue; it combines brett's lintl
patch with the fix for --enable-framework.

--
Added file: http://bugs.python.org/file14174/darwin_lintl_framework.patch

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



[issue6154] Python 3.1 rc1 will not build on OS X 10.5.7 with macports libintl

2009-06-03 Thread Evan Behar

Evan Behar  added the comment:

Curiously, if I define --with-pydebug I get

ld: Undefined symbols:
___eprintf

If I don't define --with-pydebug but I do use --enable-universalsdk I
get a whole different problem:

gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk 
-fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE  -c
./Modules/_localemodule.c -o Modules/_localemodule.o
./Modules/_localemodule.c:28:21: error: libintl.h: No such file or directory

This leads to whole bunch of other crap.

libintl.h is used in other forms of the build, so I'm not sure why this
is cropping up.

I also have no idea what ___eprintf is.

--

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



[issue6154] Python 3.1 rc1 will not build on OS X 10.5.7 with macports libintl

2009-06-03 Thread Evan Behar

Evan Behar  added the comment:

I haven't got any library issues using --enable-universalsdk, it won't
get to the linking stage becaue it doesn't find libintl.h

And with --with-pydebug still doesn't build because it won't find
___eprintf, whatever that is.

The only version of libintl on my system is universal, so I don't think
that's related.

--

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



[issue6234] cgi.FieldStorage is broken when given POST data

2009-06-07 Thread Evan Fosmark

New submission from Evan Fosmark :

Right now, it seems impossible to use cgi.FieldStorage in 3.0 if you're
giving it environ['wsgi.input'] like so:

post_data = cgi.FieldStorage(
fp=environ["wsgi.input"],
environ=environ,
keep_blank_values=True
)


It gives the following error:

  File "/usr/local/lib/python3.0/cgi.py", line 489, in __init__
self.read_urlencoded()
  File "/usr/local/lib/python3.0/cgi.py", line 589, in read_urlencoded
self.strict_parsing):
  File "/usr/local/lib/python3.0/urllib/parse.py", line 377, in
parse_qsl
pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
TypeError: Type str doesn't support the buffer API

--
components: Library (Lib)
messages: 89060
nosy: efosmark
severity: normal
status: open
title: cgi.FieldStorage is broken when given POST data
type: behavior
versions: Python 3.0

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



[issue6825] Minor documentation bug with os.path.split

2009-09-02 Thread Evan Driscoll

New submission from Evan Driscoll :

The documentation for os.path.split says, in part:

  "In nearly all cases, join(head, tail) equals path (the only 
  exception being when there were multiple slashes separating head
  from tail)."

But this is not quite true: that's not the *only* exception, at least
without a somewhat liberal definition of "equals".

This can also happen if os.altsep is used in the path being split, in
which case it will be replaced by os.sep:

>>> import ntpath
>>> path = "a/b"
>>> (head, tail) = ntpath.split(path)
>>> joined = ntpath.join(head, tail)
>>> joined == path
False
>>> joined
'a\\b'


[I only selected the versions that I actually verified, but I would
guess it's present in more.]

--
assignee: georg.brandl
components: Documentation
messages: 92180
nosy: evaned, georg.brandl
severity: normal
status: open
title: Minor documentation bug with os.path.split
versions: Python 2.6, Python 2.7, Python 3.1

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



[issue3445] Ignore missing attributes in functools.update_wrapper

2010-01-13 Thread Evan Klitzke

Evan Klitzke  added the comment:

I'm also interested in seeing this fixed. In the current behavior, the 
following code doesn't work:

<<< start code
from functools import wraps

def magic(func):
@wraps(func)
def even_more_magic(*args):
return func(*args)
return even_more_magic

class Frob(object):
@magic
@classmethod
def hello(cls):
print '%r says hello' % (cls,)
>>> end code

It fails because classmethods don't have a __module__ attribute, as commented 
upon elsewhere in this issue. To fix this, you'd either have to either pass in 
an `assigned` parameter to the `wraps` function, or swap the order of decorator 
application (i.e. `classmethod(magic(hello))`).

This seems arbitrary and unnecessarily complex; skipping over a missing 
__module__ should be just fine. Mixing `functools.wraps` and `classmethod` is a 
relatively common use case that should be as simple as possible.

I've attached a trivial patch which just ignores missing "assigned" attributes.

--
keywords: +patch
nosy: +eklitzke
Added file: http://bugs.python.org/file15865/fix.patch

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



[issue3445] Ignore missing attributes in functools.update_wrapper

2010-01-15 Thread Evan Klitzke

Evan Klitzke  added the comment:

New patch included, with a test case.

I had wanted to check the classmethod __module__ thing directly, but that 
proved to be elusive, since the classmethod gets the __module__ attribute if 
the module is '__main__', and you can't delete that attribute. My test just 
tries to assign another attribute which doesn't exist.

I just tried to copy the style of the rest of the module, lmk if there are any 
problems.

--
Added file: http://bugs.python.org/file15903/fix.patch

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



[issue7735] python creates IPv6 DNS requests even when built with --disable-ipv6

2010-01-18 Thread Evan Teran

New submission from Evan Teran :

I have encountered an issue where python will do a  request even when built 
without IPv6. This becomes an issue because on some configurations this seems 
to cause a 5 second delay on DNS lookups (that is a separate issue of course). 
Basically here is what I am seeing:

#!/usr/bin/python
import urllib2
print urllib2.urlopen('http://python.org/').read(100)

results in the following:

0.00  10.102.0.79 -> 8.8.8.8  DNS Standard query A python.org
  0.23  10.102.0.79 -> 8.8.8.8  DNS Standard query  python.org
  0.005369  8.8.8.8 -> 10.102.0.79  DNS Standard query response A 
82.94.164.162
  5.004494  10.102.0.79 -> 8.8.8.8  DNS Standard query A python.org
  5.010540  8.8.8.8 -> 10.102.0.79  DNS Standard query response A 
82.94.164.162
  5.010599  10.102.0.79 -> 8.8.8.8  DNS Standard query  python.org
  5.015832  8.8.8.8 -> 10.102.0.79  DNS Standard query response  
2001:888:2000:d::a2

looking at socket.py in create_connection() (line 500 on my python 2.6.4 
stdlib) the code is like this:

for res in getaddrinfo(host, port, 0, SOCK_STREAM):
af, socktype, proto, canonname, sa = res
sock = None
try:
sock = socket(af, socktype, proto)
if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
sock.settimeout(timeout)
sock.connect(sa)
return sock

except error, msg:
if sock is not None:
sock.close()

The 3rd argument is the socket type, which is set to 0 which apparently means 
unspecified. It seems to me that if python is built without IPv6 support it 
should instead pass AF_INET since even if it does get an IPv6 response it can't 
possibly use it.

--
components: None
messages: 98036
nosy: Evan.Teran
severity: normal
status: open
title: python creates IPv6 DNS requests even when built with --disable-ipv6
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue5526] Local variables unavailable for operation of list comprehension when using eval()

2009-03-19 Thread Evan Greensmith

New submission from Evan Greensmith :

In python 3.0 and 3.1, attempting to access a local variable from within
a list comprehension in a string passed to eval() causes a NameError. 
Doesn't seem to be a problem in python 2.6

I have attempted to run the attached test cases (test_eval_comp.py)
using the following builds of python:

Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32

Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit
(Intel)] on win32

Python 3.1a1 (r31a1:70244, Mar  8 2009, 18:15:03) [MSC v.1500 32 bit
(Intel)] on win32

All tests passed with Python 2.6.1.  The following five tests failed
with Python 3.0.1 and 3.1a1

EvalWithComprehensionTestCase.test_local_var
NameError: global name 'value' is not defined
EvalWithComprehensionTestCase.test_function_arg
NameError: global name 'value' is not defined
EvalWithComprehensionTestCase.test_self_attrib
NameError: global name 'self' is not defined
ExampleFromDocsTestCase.test_local_var
NameError: global name 'vec1' is not defined
NestedComprehensionExampleFromDocsTestCase.test_local_var
NameError: global name 'mat' is not defined

--
files: test_eval_comp.py
messages: 83852
nosy: evan.greensmith
severity: normal
status: open
title: Local variables unavailable for operation of list comprehension when 
using eval()
versions: Python 3.0, Python 3.1
Added file: http://bugs.python.org/file13382/test_eval_comp.py

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