Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] threading.Thread.setDaemon has been deprecated in favor of setting daemon attribute directly in Python 3.10 #2643

@tirkarthi

Description

@tirkarthi

setuptools version

master branch

Python version

Python 3.10

OS

Linux

Additional environment information

No response

Description

threading.setDaemon has been deprecated in favor of setting daemon attribute directly in Python 3.10 . Ref : python/cpython#25174

Expected behavior

Set daemon attribute directly.

How to Reproduce

  1. Run PYTHONWARNINGS=always python -m pytest setuptools/tests/test_easy_install.py -k test_setup_requires_honors_fetch_params with python from master branch.

Output

PYTHONWARNINGS=always python -m pytest setuptools/tests/test_easy_install.py -k test_setup_requires_honors_fetch_params
/root/py310-dev-venv/lib/python3.10/site-packages/pytest_virtualenv.py:5: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils import sysconfig
/root/py310-dev-venv/lib/python3.10/site-packages/pytest_shutil/workspace.py:23: PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
Use @pytest.fixture instead; they are the same.
  @pytest.yield_fixture()
/root/py310-dev-venv/lib/python3.10/site-packages/pytest_shutil/run.py:6: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
  import imp
/root/py310-dev-venv/lib/python3.10/site-packages/pytest_virtualenv.py:31: PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
Use @pytest.fixture instead; they are the same.
  @yield_fixture(scope='function')
========================================================================= test session starts ==========================================================================
platform linux -- Python 3.10.0a7+, pytest-6.3.0.dev369+g9078c3ce2, py-1.10.0, pluggy-0.13.1
rootdir: /root/checked_repos_clone/setuptools, configfile: pytest.ini
plugins: flake8-1.0.7, virtualenv-1.7.0, shutil-1.7.0, cov-2.11.1
collected 48 items / 47 deselected / 1 selected                                                                                                                        

setuptools/tests/test_easy_install.py E                                                                                                                          [100%]

================================================================================ ERRORS ================================================================================
_____________________________________________ ERROR at setup of TestSetupRequires.test_setup_requires_honors_fetch_params ______________________________________________

/root/cpython/Lib/sre_parse.py:529: ResourceWarning: unclosed <socket.socket fd=11, family=AF_INET, type=SOCK_STREAM, proto=0, laddr=('0.0.0.0', 33357)>
  subpatternappend((LITERAL, _ord(this)))
ResourceWarning: Enable tracemalloc to get the object allocation traceback
    @pytest.fixture
    def mock_index():
        # set up a server which will simulate an alternate package index.
>       p_index = MockServer()

setuptools/tests/test_easy_install.py:434: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
setuptools/tests/server.py:68: in __init__
    self.setDaemon(True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MockServer(Thread-1, initial)>, daemonic = True

    def setDaemon(self, daemonic):
        """Set whether this thread is a daemon.
    
        This method is deprecated, use the .daemon property instead.
    
        """
        import warnings
>       warnings.warn('setDaemon() is deprecated, set the daemon attribute instead',
                      DeprecationWarning, stacklevel=2)
E       DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead

/root/cpython/Lib/threading.py:1184: DeprecationWarning
=================================================================== 47 deselected, 1 error in 0.52s ===================================================================

Code of Conduct

  • I agree to follow the PSF Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions