Skip to content

issue with socket._GLOBAL_DEFAULT_TIMEOUT  #19

@thehesiod

Description

@thehesiod

I had a scenario where I did something like this (sorry, don't have it exactly anymore):

reloader.py:

import reloader
def droneReloader():
    import drone
    return drone.drone()

reloader.enable()
while droneReloader(): pass

drone.py:

import Utils
Utils.ftpStuff()

Utils.py:

import ftplib

def ftpStuff():
    ftplib.FTP('foo.com')

The issue I noticed is that after refreshing Utils.py, and then reloading drone.py, FTP would error out because eventually it decided that the default timeout was != socket._GLOBAL_DEFAULT_TIMEOUT and therefore tried to pass a generic object to timeout and error stating that it wasn't a float.

I think whats happening is that the object() used as the _GLOBAL_DEFAULT_TIMEOUT reference gets replaced between ftplib/socket after the module gets re-loaded so it doesn't recognize it anymore. I think socket.py shouldn't be using this mechanism as the default anyways, its dumb, it should instead have used -1 or something...however, whats the recommended solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions