[Patches] [ python-Patches-523944 ] imputil.py can't import "\r\n" .py files

noreply@sourceforge.net noreply@sourceforge.net
Fri, 28 Jun 2002 16:31:17 -0700


Patches item #523944, was opened at 2002-02-28 17:17
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=523944&group_id=5470

Category: Library (Lib)
Group: Python 2.2.x
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Mitch Chapman (mitchchapman)
>Assigned to: Jeremy Hylton (jhylton)
>Summary: imputil.py can't import "\r\n" .py files

Initial Comment:
__builtin__.compile() requires that codestring line endings consist of
"\n".  imputil._compile() does not enforce this.  One result is that
imputil may be unable to import modules created on Win32.

The attached patch to the latest (CVS revision 1.23) imputil.py
replaces both "\r\n" and "\r" with "\n" before passing a code string
to __builtin__.compile().  This is consistent with the behavior of
e.g. Lib/py_compile.py.


----------------------------------------------------------------------

>Comment By: Jeremy Hylton (jhylton)
Date: 2002-06-28 23:31

Message:
Logged In: YES 
user_id=31392

I fixed this in CVS python by opening file in "rU" mode.


----------------------------------------------------------------------

Comment By: Greg Stein (gstein)
Date: 2002-03-18 07:07

Message:
Logged In: YES 
user_id=6501

I've been out this weekend, so no... won't make it by Monday
the 18th.

----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2002-03-16 16:42

Message:
Logged In: YES 
user_id=6656

Greg any chance of comments before 2.2.1c1, i.e. Monday?

----------------------------------------------------------------------

Comment By: M.-A. Lemburg (lemburg)
Date: 2002-03-06 17:14

Message:
Logged In: YES 
user_id=38388

Assigning to Greg Stein -- imputil.py is his baby.

----------------------------------------------------------------------

Comment By: Mitch Chapman (mitchchapman)
Date: 2002-03-06 17:03

Message:
Logged In: YES 
user_id=348188

Please pardon if it's inappropriate to assign patches to project developers.
I'm doing so on the advice of a post by Skip Montanaro.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=523944&group_id=5470