[ python-Bugs-1707768 ] os.path.normpath changes path (chops of trailing slash)

2007-05-06 Thread SourceForge.net
Bugs item #1707768, was opened at 2007-04-25 23:44
Message generated for change (Comment added) made by josm
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1707768&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.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Robert Siemer (siemer)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.path.normpath changes path (chops of trailing slash)

Initial Comment:
Hello everybody!

>>> os.path.normpath('/etc/passwd')
'/etc/passwd'


I don't know any environment at all where

a) '/etc/passwd/'
b) '/etc/passwd'

are treated the same. It clearly does not apply for the path part of http urls 
(this is left as an exercise for the reader).

But it also does not apply for (e.g.) Linux either:
an open() on path a) return ENOTDIR while it succeeds with b).

(assuming /etc/passwd is a file)

This is definitively not a documentation bug, as "normpath" should normalize a 
path and not fuck it up.


Robert

--

Comment By: jos (josm)
Date: 2007-05-06 09:31

Message:
Logged In: YES 
user_id=1776568
Originator: NO

Like all other python libraries, posixpath.normpath has its test cases,
which specify what normpath is supposed to work.
See test_normpath() in Lib/test/test_posixpath.py.

siemer, would you add some test cases for this problem to
test_posixpath.py?
I think it needs not just adding but also need to update existent cases.
That means it would break backwards-compatibility.

According to http://www.python.org/dev/intro/,
changing existing functionality "requires python- dev as a whole to agree
to the change."

So the TODO list would be

1. Write test cases for this problem and post it to the patch manager
2. Discuss the changes on python-dev at python.org and get agreement
3. Write patch and post it to the patch manager
4. Get some reviews
5. Commit

Correct Me If I'm Wrong.

--

Comment By: Robert Siemer (siemer)
Date: 2007-05-06 04:15

Message:
Logged In: YES 
user_id=150699
Originator: YES

1) I (submitter) didn't specify what I expected to see:

os.path.normpath('/etc/passwd/') --> '/etc/passwd/'

So, I agree with the latest consensus, but definitely not with the
"/etc/passwd/." version...


2) I can't draw any explicit normalization rules from the excerpts of the
POSIX standard posted by iszegedi. Saying that "dir/" should be treated as
"dir/." doesn't mean that it is the normalized version of the first one. -
I actually read implicitly that the first one is the habitual one that
needs interpretation.

And I think everybody agrees that - beeing the same or not - "dir/." is
unusual.

3) I don't know what this is good for in the proposal:
path = path.rstrip()

It removes significant whitespace from the path, what must be avoided.

--

Comment By: Istvan Szegedi (iszegedi)
Date: 2007-05-01 18:05

Message:
Logged In: YES 
user_id=1772412
Originator: NO

I must admit that josm's comments make sense: in fact, I quickly tried out
how mkdir command from a bash shell would behave and it does the same:

# mkdir hello
# rmdir hello/. 
Invalid argument

whereas
# rmdir hello/

works fine. I also wrote a small C program using mkdir() and rmdir()
functions and they behave exactly the same as mkdir/rmdir from bash (well,
no real suprise).

My suggestion to get the original issue fixed was based on POSIX standard
and apparently the Linux commands are not fully POSIX compliant, either...
Or do I misunderstand the quotes from the standard?  Anyway, it is pretty
easy to modify my fix to be inline with Linux commands and C functions -
everything could be the same, apart from the last line where I added "/." 
-- this should be only "/".  So the entire function could look like this:

-- clip --


def normpath(path):
"""Normalize path, eliminating double slashes, etc."""
if path == '':
return '.'
initial_slashes = path.startswith('/')
# The next two lines were added by iszegedi
path = path.rstrip()
trailing_slash = path.endswith('/')
# POSIX allows one or two initial slashes, but treats three or more
# as single slash.
if (initial_slashes and
path.startswith('//') and not path.startswith('///')):
initial_slashes = 2
comps = path.split('/')
new_comps = []
for comp in comps:
if comp in ('', '.'):
continue
if (comp != '..' or (not initial_slashes and not new_comps) or
 (new_comps and new_comps[-1] == '..')):
new_comps.append(comp)
elif new_comps:
new_comps.pop()
comps = new_comps
path = '/'.join(comps)
if init

[ python-Feature Requests-1713877 ] Expose callback API in readline module

2007-05-06 Thread SourceForge.net
Feature Requests item #1713877, was opened at 2007-05-06 20:07
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1713877&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
Private: No
Submitted By: strank (strank)
Assigned to: Nobody/Anonymous (nobody)
Summary: Expose callback API in readline module

Initial Comment:
This is a request to expose the `callback API`_ of GNU readline in the readline 
module in the Python library.

.. _callback API: 
http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC41

This interface is suitable for asynchronous use, such as with twisted.

It is possible to expose the functions on Unix with ctypes::

  import readline
  import ctypes

  rl_lib = ctypes.cdll.LoadLibrary("libreadline.so.5")

  readline.callback_handler_remove = rl_lib.rl_callback_handler_remove
  readline.callback_read_char = rl_lib.rl_callback_read_char
  # the callback needs special treatment:
  rlcallbackfunctype = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_char_p)
  def setcallbackfunc(prompt, thefunc):
  rl_lib.rl_callback_handler_install(prompt, rlcallbackfunctype(thefunc))
  readline.callback_handler_install = setcallbackfunc

but it would be much better to expose them "officially".


--

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



[ python-Bugs-1713993 ] smtplib starttls() didn't do TLS Close Notify when quit()

2007-05-06 Thread SourceForge.net
Bugs item #1713993, was opened at 2007-05-07 09:40
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=1713993&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: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: AndCycle (andcycle)
Assigned to: Nobody/Anonymous (nobody)
Summary: smtplib starttls() didn't do TLS Close Notify when quit()

Initial Comment:
[code]
server = smtplib.SMTP('smtp.gmail.com')
server.set_debuglevel(1)
server.ehlo('x')
server.starttls()
server.ehlo('x')
server.noop()
server.rset()
server.quit()
[/code]
will always result in "sslerror: (8, 'EOF occurred in violation of protocol')",
although this won't really effect data transmission but this is really annoying,

relative discussion can be found
http://www.dbforums.com/archive/index.php/t-1401931.html


--

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



[ python-Bugs-1713993 ] smtplib starttls() didn't do TLS Close Notify when quit()

2007-05-06 Thread SourceForge.net
Bugs item #1713993, was opened at 2007-05-07 09:40
Message generated for change (Settings changed) made by andcycle
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1713993&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: None
Status: Open
Resolution: None
>Priority: 1
Private: No
Submitted By: AndCycle (andcycle)
Assigned to: Nobody/Anonymous (nobody)
Summary: smtplib starttls() didn't do TLS Close Notify when quit()

Initial Comment:
[code]
server = smtplib.SMTP('smtp.gmail.com')
server.set_debuglevel(1)
server.ehlo('x')
server.starttls()
server.ehlo('x')
server.noop()
server.rset()
server.quit()
[/code]
will always result in "sslerror: (8, 'EOF occurred in violation of protocol')",
although this won't really effect data transmission but this is really annoying,

relative discussion can be found
http://www.dbforums.com/archive/index.php/t-1401931.html


--

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



[ python-Bugs-1713993 ] smtplib starttls() didn't do TLS Close Notify when quit()

2007-05-06 Thread SourceForge.net
Bugs item #1713993, was opened at 2007-05-07 09:40
Message generated for change (Settings changed) made by andcycle
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1713993&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: None
>Status: Deleted
Resolution: None
Priority: 1
Private: No
Submitted By: AndCycle (andcycle)
Assigned to: Nobody/Anonymous (nobody)
Summary: smtplib starttls() didn't do TLS Close Notify when quit()

Initial Comment:
[code]
server = smtplib.SMTP('smtp.gmail.com')
server.set_debuglevel(1)
server.ehlo('x')
server.starttls()
server.ehlo('x')
server.noop()
server.rset()
server.quit()
[/code]
will always result in "sslerror: (8, 'EOF occurred in violation of protocol')",
although this won't really effect data transmission but this is really annoying,

relative discussion can be found
http://www.dbforums.com/archive/index.php/t-1401931.html


--

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



[ python-Bugs-1713999 ] Multiple re.compile flags cause error

2007-05-06 Thread SourceForge.net
Bugs item #1713999, was opened at 2007-05-06 21:05
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=1713999&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: Regular Expressions
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Saul Spatz (saulspatz)
Assigned to: Gustavo Niemeyer (niemeyer)
Summary: Multiple re.compile flags cause error

Initial Comment:
The documentation for re.compile() shows that multiple flags are allowed, but 

re.compile(r'.*', re.VERBOSE, re.DOTALL)

results in an error message that only two arguments are allowed and three were 
given.

I'm using python 2.5 with Windows XP Home edition.

--

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



[ python-Bugs-1713252 ] character set in Japanese on Ubuntu distribution

2007-05-06 Thread SourceForge.net
Bugs item #1713252, was opened at 2007-05-04 22:16
Message generated for change (Comment added) made by cgrell
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1713252&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: IDLE
Group: Python 2.5
>Status: Open
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Christopher Grell (cgrell)
Assigned to: Nobody/Anonymous (nobody)
Summary: character set in Japanese on Ubuntu distribution

Initial Comment:
I tried to use IDLE on new Ubuntu 7.04 and the window opens with Japanese 
character set

--

>Comment By: Christopher Grell (cgrell)
Date: 2007-05-06 19:42

Message:
Logged In: YES 
user_id=1785859
Originator: YES

Changing default character size to 20 removes the issue

--

Comment By: Georg Brandl (gbrandl)
Date: 2007-05-05 00:08

Message:
Logged In: YES 
user_id=849994
Originator: NO

As this is certainly not the case in other distributions, this is
something you should file with the Ubuntu bug tracker.

--

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



[ python-Bugs-1713999 ] Multiple re.compile flags cause error

2007-05-06 Thread SourceForge.net
Bugs item #1713999, was opened at 2007-05-06 23:05
Message generated for change (Comment added) made by gagenellina
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1713999&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: Regular Expressions
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Saul Spatz (saulspatz)
Assigned to: Gustavo Niemeyer (niemeyer)
Summary: Multiple re.compile flags cause error

Initial Comment:
The documentation for re.compile() shows that multiple flags are allowed, but 

re.compile(r'.*', re.VERBOSE, re.DOTALL)

results in an error message that only two arguments are allowed and three were 
given.

I'm using python 2.5 with Windows XP Home edition.

--

Comment By: Gabriel Genellina (gagenellina)
Date: 2007-05-07 02:10

Message:
Logged In: YES 
user_id=479790
Originator: NO

Multiple flags must be ORed together: re.compile(r'.*', re.VERBOSE |
re.DOTALL)
>From the re module documentation at
http://docs.python.org/lib/node46.html: "Values can be any of the following
variables, combined using bitwise OR (the | operator)." 



--

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



[ python-Bugs-1711800 ] SequenceMatcher bug with insert/delete block after "replace"

2007-05-06 Thread SourceForge.net
Bugs item #1711800, was opened at 2007-05-03 07:24
Message generated for change (Comment added) made by gagenellina
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1711800&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.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Christian Hammond (chipx86)
Assigned to: Nobody/Anonymous (nobody)
Summary: SequenceMatcher bug with insert/delete block after "replace"

Initial Comment:
difflib.SequenceMatcher fails to distinguish between a "replace" block and an 
"insert" or "delete" block when the "insert/delete" immediately follows a 
"replace". It will lump both changes together as one big "replace" block.

This happens due to how get_opcodes() works. get_opcodes() loops through the 
matching blocks, grouping them into tags and ranges. However, if a block of 
text is changed and then new text is immediately added, it can't see this. All 
it knows is that the next matching block is after the added text.

As an example, consider these strings:

"ABC"

"ABCD
EFG."

Any diffing program will show that the first line was replaced and the second 
was inserted. SequenceMatcher, however, just shows that there was one replace, 
and includes both lines in the range.

I've attached a testcase that reproduces this for both replace>insert and 
replace>delete blocks.

--

Comment By: Gabriel Genellina (gagenellina)
Date: 2007-05-07 02:40

Message:
Logged In: YES 
user_id=479790
Originator: NO

Maybe you are more interested on a Differ object. These are the results
from your example using '\n'.join(difflib.Differ().compare(a,b))

- This is my old file, containing only one line.
+ This is my new file.
+ It contains multiple lines.
+ SequenceMatcher should see two blocks as a result.

and 

+ This is my new file, containing only one line.
- This is my old file.
- It contains multiple lines.
- SequenceMatcher should see two blocks as a result.


--

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