[ python-Bugs-1550938 ] from . import bug

2006-09-03 Thread SourceForge.net
Bugs item #1550938, was opened at 2006-09-02 09:05
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1550938&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 8
Submitted By: ganges master (gangesmaster)
Assigned to: Neal Norwitz (nnorwitz)
Summary: from . import bug

Initial Comment:
>>> from . import foo
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Relative importpath too deep

it should raise ImportError, as the module does not exist.
there's nothing wrong with the path being too deep.



--

>Comment By: Georg Brandl (gbrandl)
Date: 2006-09-03 07:10

Message:
Logged In: YES 
user_id=849994

See attached patch.

I couldn't find a mention of this ValueError in the PEP or
the docs, so changing it to ImportError and giving better
error messages looks like the way to go.

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-09-02 18:49

Message:
Logged In: YES 
user_id=33168

Can you provide a patch to fix it?  I'll make a decision
partly based on the patch.

--

Comment By: Georg Brandl (gbrandl)
Date: 2006-09-02 09:21

Message:
Logged In: YES 
user_id=849994

Agreed. Can we fix this for 2.5?

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1550938&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1551427 ] tiny bug in win32_urandom

2006-09-03 Thread SourceForge.net
Bugs item #1551427, was opened at 2006-09-03 14:03
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1551427&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Rocco Matano (rocco_m)
Assigned to: Nobody/Anonymous (nobody)
Summary: tiny bug in win32_urandom

Initial Comment:
In the file ...\Python-2.4.3\Modules\posixmodule.c the
function win32_urandom
tries to get the addresses of the functions
'CryptAcquireContextA' and
'CryptGenRandom' like this:

pCryptAcquireContext=(CRYPTACQUIRECONTEXTA)GetProcAddress(
hAdvAPI32, "CryptAcquireContextA");
if (pCryptAcquireContext == NULL)
return PyErr_Format(PyExc_NotImplementedError,
"CryptAcquireContextA not found");

pCryptGenRandom = (CRYPTGENRANDOM)GetProcAddress(
hAdvAPI32, "CryptGenRandom");
if (pCryptAcquireContext == NULL) /* <- test
pCryptGenRandom instead */
return PyErr_Format(PyExc_NotImplementedError,
"CryptGenRandom not found");

After the second call to GetProcAddress()
pCryptGenRandom should be tested
against NULL.


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1551427&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1551432 ] __unicode__ breaks for exception class objects

2006-09-03 Thread SourceForge.net
Bugs item #1551432, was opened at 2006-09-03 14:24
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1551432&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Marcin 'Qrczak' Kowalczyk (qrczak)
Assigned to: Nobody/Anonymous (nobody)
Summary: __unicode__ breaks for exception class objects

Initial Comment:
PyObject_Unicode and the unicode function stopped
working on class objects of subclasses of BaseException
in Python 2.5.

>>> unicode(ImportError)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: descriptor '__unicode__' of
'exceptions.BaseException' object needs an argument

It should work analogously to str:

>>> str(ImportError)
""

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1551432&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1548288 ] sgmllib.sgmlparser is not thread safe

2006-09-03 Thread SourceForge.net
Bugs item #1548288, was opened at 2006-08-28 19:32
Message generated for change (Comment added) made by josiahcarlson
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1548288&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Andres Riancho (andresriancho)
Assigned to: Nobody/Anonymous (nobody)
Summary: sgmllib.sgmlparser is not thread safe

Initial Comment:
Python version:
===

[EMAIL PROTECTED]:~$ python
Python 2.4.3 (#2, Apr 27 2006, 14:43:58)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2

Problem description:


sgmlparser is not thread safe, i discovered this
problem when trying to fetch and parse many html files
at the same time. 

An example of this bug can be found attached.

The sgmlparser input html is this string:
''*100 , this was written this way to
simplify the code, please note that if you replace this
string with a "large" html document, it will also fail.

solution:
=

make the lib thread safe, or add some lines to the
documentation saying that it aint thread safe.


Traceback:
==
 python sgml-not-threadSafe.py
Started all threads
Successfully parsed html
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python2.4/threading.py", line 442, in
__bootstrap
self.run()
  File "/usr/lib/python2.4/threading.py", line 422, in run
self.__target(*self.__args, **self.__kwargs)
  File "sgml-not-threadSafe.py", line 10, in parseHtml
self._parser.feed( html )
  File "/usr/lib/python2.4/sgmllib.py", line 95, in feed
self.goahead(0)
  File "/usr/lib/python2.4/sgmllib.py", line 129, in
goahead
k = self.parse_starttag(i)
  File "/usr/lib/python2.4/sgmllib.py", line 262, in
parse_starttag
self.error('unexpected call to parse_starttag')
  File "/usr/lib/python2.4/sgmllib.py", line 102, in error
raise SGMLParseError(message)
SGMLParseError: unexpected call to parse_starttag

Successfully parsed html
Successfully parsed html

Additional note
===

To recreate this bug, you should run the sample code
more than one time. Thread handling aint always the
same, the issue is there but sometimes it fails to
appear on the first (second, third...) run.

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2006-09-03 12:02

Message:
Logged In: YES 
user_id=341410

The sgmllib makes no claims as to thread safety, which
implies that it is generally not sharable between threads.

You can work around this issue by creating a new parser
instance for each thread that you want to parse.

Suggested close as "Wont Fix".

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1548288&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Feature Requests-1548178 ] Add 'find' method to sequence types

2006-09-03 Thread SourceForge.net
Feature Requests item #1548178, was opened at 2006-08-28 13:47
Message generated for change (Comment added) made by josiahcarlson
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1548178&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 4
Submitted By: kovan (kovan)
Assigned to: Nobody/Anonymous (nobody)
Summary: Add 'find' method to sequence types

Initial Comment:
In the benefit of Python's readability and simplicity,
a 'find' method could be added to sequence types, that
would return the first item in the list that matches
some criteria.
For example, it's a common practice to use lists of
(key,value) pairs instead of dictionaries when the
sequence must be ordered.
To find an element maching a key in such cases, I
frequently find myself writing (IMHO) too much code for
such a straightforward operation. AFAIK currently there
are two easy ways to do this (shouln't be one, and only
one?):

for item in items:
  if item.attribute == key:
foundItem = item
break
else: foundItem = None

OR

foundItems = [item for item in items if item.key ==  value]
if foundItems:
  foundItem = foundItem[0]

IMO, in none of the cases the code is as clear and,
specially, as short, as it should be.

With the find method, the same code would be:

item = items.find(lambda x: x.key == value)

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2006-09-03 12:07

Message:
Logged In: YES 
user_id=341410

Lists have an .index(obj[, start[, stop]]) method that tells
you the index of the first object that matches obj, raising
an exception otherwise.

Generally speaking, you can get better performance for
repeated searches by...

dct = {}
for i,(k,v) in enumerate(lst):
dct.setdefault(k, []).append(i)

Then to find the first index...

dct.get(k, [None])[0]

Suggested close.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1548178&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1544106 ] test_anydbm segmentation fault

2006-09-03 Thread SourceForge.net
Bugs item #1544106, was opened at 2006-08-21 11:02
Message generated for change (Comment added) made by greg
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1544106&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Clay Spence (cspence)
Assigned to: Gregory P. Smith (greg)
Summary: test_anydbm segmentation fault

Initial Comment:
After building 2.5rc1 and bfore installing, make test
failed for me at test_anydbm:

cholla 88% uname -a
Linux cholla.sarnoff.com 2.6.9-34.ELsmp #1 SMP Fri Feb
24 16:54:53 EST 2006 i686 i686 i386 GNU/Linux

cholla 89% ./python
Python 2.5c1 (r25c1:51305, Aug 21 2006, 11:30:37)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>>

cholla 90% ./python ./Lib/test/test_anydbm.py
Segmentation fault

cholla 91%

I tracked this to Lib/bsddb/__init__.py, line 355, in
_openDBEnv(): e.set_lk_detect(db.DB_LOCK_DEFAULT) See
the attached pdb text output, if it's useful.


--

>Comment By: Gregory P. Smith (greg)
Date: 2006-09-03 16:14

Message:
Logged In: YES 
user_id=413

weird i would not expect this to happen regardless of
berkeleydb version.

can you also do a 'ldd' on the _bsddb.so binary that your
python build produced?  presumably libdb42.so or something
similar should be in the output.

also, when to compile python does it print out a message
saying what version of the include files and libs it thinks
its compiling and linking with?

it looks like you're using rhel4 or centos4; i'll try
compiling 2.5rc1 on that myself when i get a chance.


--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-08-22 06:45

Message:
Logged In: YES 
user_id=33168

Yes, correct.  4.2.52 is the version of the C BSD DB
library.  That's a fairly old version.  I believe the bug is
in there.  If you update to 4.3.x or 4.4.x, I suspect the
problem will go away.

I know very little about bsddb.  The code looks quite
simple.  Assigning Greg as he's probably the only one that
has a chance of knowing.

--

Comment By: Clay Spence (cspence)
Date: 2006-08-22 06:26

Message:
Logged In: YES 
user_id=685289

Excuse my ignorance, but I'm not sure how to determine the
version. Poking around gives me:

cholla 92% ./python
Python 2.5c1 (r25c1:51305, Aug 21 2006, 11:30:37)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> import bsddb
>>> bsddb.__version__
'4.4.5'
>>> bsddb._bsddb.version()
(4, 2, 52)
>>>

Is it the second?

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-08-21 16:28

Message:
Logged In: YES 
user_id=33168

I'm guessing this is an old version of berkeley db.  What
version of bdb are you using?

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1544106&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1544106 ] test_anydbm segmentation fault

2006-09-03 Thread SourceForge.net
Bugs item #1544106, was opened at 2006-08-21 11:02
Message generated for change (Comment added) made by greg
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1544106&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Clay Spence (cspence)
Assigned to: Gregory P. Smith (greg)
Summary: test_anydbm segmentation fault

Initial Comment:
After building 2.5rc1 and bfore installing, make test
failed for me at test_anydbm:

cholla 88% uname -a
Linux cholla.sarnoff.com 2.6.9-34.ELsmp #1 SMP Fri Feb
24 16:54:53 EST 2006 i686 i686 i386 GNU/Linux

cholla 89% ./python
Python 2.5c1 (r25c1:51305, Aug 21 2006, 11:30:37)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>>

cholla 90% ./python ./Lib/test/test_anydbm.py
Segmentation fault

cholla 91%

I tracked this to Lib/bsddb/__init__.py, line 355, in
_openDBEnv(): e.set_lk_detect(db.DB_LOCK_DEFAULT) See
the attached pdb text output, if it's useful.


--

>Comment By: Gregory P. Smith (greg)
Date: 2006-09-03 16:41

Message:
Logged In: YES 
user_id=413

i was unable to reproduce this problem on either 32-bit or
64-bit CentOS 4.

--

Comment By: Gregory P. Smith (greg)
Date: 2006-09-03 16:14

Message:
Logged In: YES 
user_id=413

weird i would not expect this to happen regardless of
berkeleydb version.

can you also do a 'ldd' on the _bsddb.so binary that your
python build produced?  presumably libdb42.so or something
similar should be in the output.

also, when to compile python does it print out a message
saying what version of the include files and libs it thinks
its compiling and linking with?

it looks like you're using rhel4 or centos4; i'll try
compiling 2.5rc1 on that myself when i get a chance.


--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-08-22 06:45

Message:
Logged In: YES 
user_id=33168

Yes, correct.  4.2.52 is the version of the C BSD DB
library.  That's a fairly old version.  I believe the bug is
in there.  If you update to 4.3.x or 4.4.x, I suspect the
problem will go away.

I know very little about bsddb.  The code looks quite
simple.  Assigning Greg as he's probably the only one that
has a chance of knowing.

--

Comment By: Clay Spence (cspence)
Date: 2006-08-22 06:26

Message:
Logged In: YES 
user_id=685289

Excuse my ignorance, but I'm not sure how to determine the
version. Poking around gives me:

cholla 92% ./python
Python 2.5c1 (r25c1:51305, Aug 21 2006, 11:30:37)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> import bsddb
>>> bsddb.__version__
'4.4.5'
>>> bsddb._bsddb.version()
(4, 2, 52)
>>>

Is it the second?

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-08-21 16:28

Message:
Logged In: YES 
user_id=33168

I'm guessing this is an old version of berkeley db.  What
version of bdb are you using?

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1544106&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1551669 ] Wrong link to unicode database

2006-09-03 Thread SourceForge.net
Bugs item #1551669, was opened at 2006-09-03 23:55
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1551669&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Yevgen Muntyan (emuntyan)
Assigned to: Nobody/Anonymous (nobody)
Summary: Wrong link to unicode database

Initial Comment:
http://docs.python.org/lib/module-unicodedata.html has
a link to unicode database (second paragraph). The link
there is
http://www.unicode.org/Public/UNIDATA/UnicodeData.html,
it's broken. 
The correct one is probably
http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
(there are lot of files in
http://www.unicode.org/Public/UNIDATA/)



--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1551669&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1551669 ] Wrong link to unicode database

2006-09-03 Thread SourceForge.net
Bugs item #1551669, was opened at 2006-09-04 08:55
Message generated for change (Comment added) made by quiver
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1551669&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Yevgen Muntyan (emuntyan)
Assigned to: Nobody/Anonymous (nobody)
Summary: Wrong link to unicode database

Initial Comment:
http://docs.python.org/lib/module-unicodedata.html has
a link to unicode database (second paragraph). The link
there is
http://www.unicode.org/Public/UNIDATA/UnicodeData.html,
it's broken. 
The correct one is probably
http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
(there are lot of files in
http://www.unicode.org/Public/UNIDATA/)



--

>Comment By: George Yoshida (quiver)
Date: 2006-09-04 14:14

Message:
Logged In: YES 
user_id=671362

Given that Python 2.4 uses 3.2 database, we should link to  

 http://www.unicode.org/Public/3.2-Update/UnicodeCharacterDatabase-3.2.0.html

As for 2.5 and trunk(both using 4.1.0 database), they're
linked to
  http://www.unicode.org/Public/4.1.0/ucd/UCD.html

Any comments?

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1551669&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com