Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec statement balks at CR/LF #40583

Closed
hinsen mannequin opened this issue Jul 16, 2004 · 4 comments
Closed

exec statement balks at CR/LF #40583

hinsen mannequin opened this issue Jul 16, 2004 · 4 comments
Assignees
Labels
docs Documentation in the Doc dir easy interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@hinsen
Copy link
Mannequin

hinsen mannequin commented Jul 16, 2004

BPO 992207
Nosy @birkenfeld, @birkenfeld, @devdanzin

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/birkenfeld'
closed_at = <Date 2009-03-31.16:57:30.776>
created_at = <Date 2004-07-16.09:21:42.000>
labels = ['interpreter-core', 'easy', 'type-feature', 'docs']
title = 'exec statement balks at CR/LF'
updated_at = <Date 2009-03-31.16:57:30.774>
user = 'https://bugs.python.org/hinsen'

bugs.python.org fields:

activity = <Date 2009-03-31.16:57:30.774>
actor = 'georg.brandl'
assignee = 'georg.brandl'
closed = True
closed_date = <Date 2009-03-31.16:57:30.776>
closer = 'georg.brandl'
components = ['Documentation', 'Interpreter Core']
creation = <Date 2004-07-16.09:21:42.000>
creator = 'hinsen'
dependencies = []
files = []
hgrepos = []
issue_num = 992207
keywords = ['easy']
message_count = 4.0
messages = ['60529', '60530', '82036', '84837']
nosy_count = 4.0
nosy_names = ['georg.brandl', 'georg.brandl', 'hinsen', 'ajaksu2']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'test needed'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue992207'
versions = ['Python 2.7']

@hinsen
Copy link
Mannequin Author

hinsen mannequin commented Jul 16, 2004

Under Linux and MacOS (no others tested), if "foo.py" is a DOS/
Windows style Python file (CR/LF line endings), then

python foo.py

will work, as will

  execfile("foo.py")

and

exec file("foo.py")

from inside Python. However,

exec file("foo.py").read()

will report a syntax error. In other words, the parser seems to
accept CR/LF only if the source of the data is a file, not a string.

When running under Linux and MacOS (no others tested), the exec
statement reports a syntax error. I didn't find anything about this
in the documentation, so I don't know if it's a bug or a feature. If
it's a feature, it is not a useful one!

@hinsen hinsen mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Jul 16, 2004
@birkenfeld
Copy link
Member

Logged In: YES
user_id=1188172

I'm not sure this is a bug.

Is exec supposed to accept code in crlf-terminated strings?

@devdanzin
Copy link
Mannequin

devdanzin mannequin commented Feb 14, 2009

The behavior is still present, but I'm not sure it's a bug either. The
documentation could mention this:
http://docs.python.org/dev/reference/simple_stmts.html#exec

@devdanzin devdanzin mannequin added docs Documentation in the Doc dir easy labels Feb 14, 2009
@devdanzin devdanzin mannequin assigned birkenfeld Feb 14, 2009
@devdanzin devdanzin mannequin added type-feature A feature request or enhancement docs Documentation in the Doc dir easy labels Feb 14, 2009
@devdanzin devdanzin mannequin assigned birkenfeld Feb 14, 2009
@devdanzin devdanzin mannequin added the type-feature A feature request or enhancement label Feb 14, 2009
@birkenfeld
Copy link
Member

Documented in r70838, r70840.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir easy interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant