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

Py30a5: webbrowser.open() inf recursion #47084

Closed
mark-summerfield mannequin opened this issue May 12, 2008 · 6 comments
Closed

Py30a5: webbrowser.open() inf recursion #47084

mark-summerfield mannequin opened this issue May 12, 2008 · 6 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@mark-summerfield
Copy link
Mannequin

mark-summerfield mannequin commented May 12, 2008

BPO 2835
Nosy @amauryfa, @mark-summerfield

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 = None
closed_at = <Date 2008-05-12.14:41:20.580>
created_at = <Date 2008-05-12.09:39:30.008>
labels = ['type-bug', 'library']
title = 'Py30a5: webbrowser.open() inf recursion'
updated_at = <Date 2008-05-12.14:41:20.516>
user = 'https://github.com/mark-summerfield'

bugs.python.org fields:

activity = <Date 2008-05-12.14:41:20.516>
actor = 'amaury.forgeotdarc'
assignee = 'none'
closed = True
closed_date = <Date 2008-05-12.14:41:20.580>
closer = 'amaury.forgeotdarc'
components = ['Library (Lib)']
creation = <Date 2008-05-12.09:39:30.008>
creator = 'mark'
dependencies = []
files = []
hgrepos = []
issue_num = 2835
keywords = []
message_count = 6.0
messages = ['66716', '66721', '66722', '66723', '66725', '66726']
nosy_count = 3.0
nosy_names = ['amaury.forgeotdarc', 'mark', 'gpolo']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue2835'
versions = ['Python 2.6']

@mark-summerfield
Copy link
Mannequin Author

mark-summerfield mannequin commented May 12, 2008

There appears to be an infinite recursion in Py30a5 (doing the same
thing in Py2.5.1 works fine):

Python 3.0a5 (r30a5:62856, May  9 2008, 11:23:06) 
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "copyright", "credits" or "license()" for more information.
IDLE 3.0a5
>>> import webbrowser
>>> url = "http://www.python.org"
>>> webbrowser.open(url)
Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    webbrowser.open(url)
  File "/home/mark/opt/python30a5/lib/python3.0/webbrowser.py", line 61,
in open
    if browser.open(url, new, autoraise):
  File "/home/mark/opt/python30a5/lib/python3.0/webbrowser.py", line
350, in open
    devnull = open(os.devnull, "r+")
  File "/home/mark/opt/python30a5/lib/python3.0/webbrowser.py", line 61,
in open
    if browser.open(url, new, autoraise):
  File "/home/mark/opt/python30a5/lib/python3.0/webbrowser.py", line
350, in open
...
    devnull = open(os.devnull, "r+")
  File "/home/mark/opt/python30a5/lib/python3.0/webbrowser.py", line 61,
in open
    if browser.open(url, new, autoraise):

@mark-summerfield mark-summerfield mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 12, 2008
@gpolo
Copy link
Mannequin

gpolo mannequin commented May 12, 2008

It doesn't happen here, I'm using Linux too (Ubuntu 8.04) and py3k rev 63074

@mark-summerfield
Copy link
Mannequin Author

mark-summerfield mannequin commented May 12, 2008

I get the same bug on Fedora 8 (Python build 63161) and Kubuntu 8
(official Py30a5 release)---but not on Windows XP Home where the URL is
opened correctly.

Python 3.0a5+ (py3k:60668:63161, May 12 2008, 14:46:40)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser
>>> webbrowser.open("http://www.python.org")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mark/pycore/30/Lib/webbrowser.py", line 61, in open
if browser.open(url, new, autoraise):


Python 3.0a5 (r30a5:62856, May  9 2008, 11:27:40) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "copyright", "credits" or "license()" for more information.
IDLE 3.0a5      
>>> import webbrowser
>>> webbrowser.open("http://www.python.org")
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    webbrowser.open("http://www.python.org")
...

@amauryfa
Copy link
Member

The traceback suggest a problem when using KDE: a call to file() was
renamed to open(), this clashes with webbrowser.open().
Can you try the following patch:

Index: Lib/webbrowser.py
===================================================================
--- Lib/webbrowser.py (revision 63159)
+++ Lib/webbrowser.py (working copy)
@@ -347,7 +347,8 @@
else:
action = "openURL"

-        devnull = open(os.devnull, "r+")
+        import io
+        devnull = io.open(os.devnull, "r+")
         # if possible, put browser in separate process group, so
         # keyboard interrupts don't affect browser as well as Python
         setsid = getattr(os, 'setsid', None)

@mark-summerfield
Copy link
Mannequin Author

mark-summerfield mannequin commented May 12, 2008

On 2008-05-12, Amaury Forgeot d'Arc wrote:

Amaury Forgeot d'Arc <amauryfa@gmail.com> added the comment:

The traceback suggest a problem when using KDE: a call to file() was
renamed to open(), this clashes with webbrowser.open().
Can you try the following patch:

Index: Lib/webbrowser.py
===================================================================
--- Lib/webbrowser.py (revision 63159)
+++ Lib/webbrowser.py (working copy)
@@ -347,7 +347,8 @@
else:
action = "openURL"

  •    devnull = open(os.devnull, "r+")
    
  •    import io
    
  •    devnull = io.open(os.devnull, "r+")
       # if possible, put browser in separate process group, so
       # keyboard interrupts don't affect browser as well as Python
       setsid = getattr(os, 'setsid', None)
    

That fixed it!

@amauryfa
Copy link
Member

Corrected as r63163.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant