aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-05-17 12:25:21 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-05-17 12:25:21 +0300
commita00d05832fe021def65fe3c54c3032244b06ebc3 (patch)
treeaea0bf6c6cab76237a9207d91e80723641bb868f
parent2037874aa0fb0efca88322b14290deab89fccbd4 (diff)
downloadydb-a00d05832fe021def65fe3c54c3032244b06ebc3.tar.gz
intermediate changes
ref:37e48e308bf9be1ed239fa962cfcbbb17117f58f
-rw-r--r--contrib/python/traitlets/py3/.dist-info/METADATA80
-rw-r--r--contrib/python/traitlets/py3/traitlets/_version.py5
-rw-r--r--contrib/python/traitlets/py3/traitlets/config/application.py13
-rw-r--r--contrib/python/traitlets/py3/traitlets/config/tests/test_application.py44
4 files changed, 127 insertions, 15 deletions
diff --git a/contrib/python/traitlets/py3/.dist-info/METADATA b/contrib/python/traitlets/py3/.dist-info/METADATA
index eb35757fe1..26ae3d62b4 100644
--- a/contrib/python/traitlets/py3/.dist-info/METADATA
+++ b/contrib/python/traitlets/py3/.dist-info/METADATA
@@ -1,21 +1,82 @@
Metadata-Version: 2.1
Name: traitlets
-Version: 5.2.0
-Summary: Traitlets Python configuration system
-Keywords: Interactive,Interpreter,Shell,Web
+Version: 5.2.1.post0
+Project-URL: Homepage, https://github.com/ipython/traitlets
Author-email: IPython Development Team <ipython-dev@python.org>
-Requires-Python: >=3.7
-Description-Content-Type: text/markdown
+License: # Licensing terms
+
+ Traitlets is adapted from enthought.traits, Copyright (c) Enthought, Inc.,
+ under the terms of the Modified BSD License.
+
+ This project is licensed under the terms of the Modified BSD License
+ (also known as New or Revised or 3-Clause BSD), as follows:
+
+ - Copyright (c) 2001-, IPython Development Team
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+
+ Neither the name of the IPython Development Team nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ## About the IPython Development Team
+
+ The IPython Development Team is the set of all contributors to the IPython project.
+ This includes all of the IPython subprojects.
+
+ The core team that coordinates development on GitHub can be found here:
+ https://github.com/jupyter/.
+
+ ## Our Copyright Policy
+
+ IPython uses a shared copyright model. Each contributor maintains copyright
+ over their contributions to IPython. But, it is important to note that these
+ contributions are typically only changes to the repositories. Thus, the IPython
+ source code, in its entirety is not the copyright of any single person or
+ institution. Instead, it is the collective copyright of the entire IPython
+ Development Team. If individual contributors want to maintain a record of what
+ changes/contributions they have specific copyright on, they should indicate
+ their copyright in the commit message of the change, when they commit the
+ change to one of the IPython repositories.
+
+ With this in mind, the following banner should be used in any source code file
+ to indicate the copyright and license terms:
+
+ # Copyright (c) IPython Development Team.
+ # Distributed under the terms of the Modified BSD License.
+Keywords: Interactive,Interpreter,Shell,Web
Classifier: Intended Audience :: Developers
-Classifier: Intended Audience :: System Administrators
Classifier: Intended Audience :: Science/Research
+Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
-Requires-Dist: pytest ; extra == "test"
-Requires-Dist: pre-commit ; extra == "test"
-Project-URL: Homepage, https://github.com/ipython/traitlets
+Requires-Python: >=3.7
Provides-Extra: test
+Requires-Dist: pre-commit; extra == 'test'
+Requires-Dist: pytest; extra == 'test'
+Description-Content-Type: text/markdown
# Traitlets
@@ -211,4 +272,3 @@ Releases should be automatically build and pushed to Pypi when a tag is marked a
$ pip install build
$ python -m build .
```
-
diff --git a/contrib/python/traitlets/py3/traitlets/_version.py b/contrib/python/traitlets/py3/traitlets/_version.py
index c416b77b84..c671fe81ad 100644
--- a/contrib/python/traitlets/py3/traitlets/_version.py
+++ b/contrib/python/traitlets/py3/traitlets/_version.py
@@ -1,9 +1,10 @@
-version_info = (5, 2, 0)
+version_info = (5, 2, 1, "post0")
+__version__ = "5.2.1.post0"
# unlike `.dev`, alpha, beta and rc _must not_ have dots,
# or the wheel and tgz won't look to pip like the same version.
-__version__ = (
+assert __version__ == (
".".join(map(str, version_info)).replace(".b", "b").replace(".a", "a").replace(".rc", "rc")
)
assert ".b" not in __version__
diff --git a/contrib/python/traitlets/py3/traitlets/config/application.py b/contrib/python/traitlets/py3/traitlets/config/application.py
index 02dc72eb56..e5a8686742 100644
--- a/contrib/python/traitlets/py3/traitlets/config/application.py
+++ b/contrib/python/traitlets/py3/traitlets/config/application.py
@@ -276,6 +276,8 @@ class Application(SingletonConfigurable):
config = self.get_default_logging_config()
nested_update(config, self.logging_config or {})
dictConfig(config)
+ # make a note that we have configured logging
+ self._logging_configured = True
@default("log")
def _log_default(self):
@@ -942,9 +944,14 @@ class Application(SingletonConfigurable):
return "\n".join(lines)
def close_handlers(self):
- for handler in self.log.handlers:
- with suppress(Exception):
- handler.close()
+ if getattr(self, "_logging_configured", False):
+ # don't attempt to close handlers unless they have been opened
+ # (note accessing self.log.handlers will create handlers if they
+ # have not yet been initialised)
+ for handler in self.log.handlers:
+ with suppress(Exception):
+ handler.close()
+ self._logging_configured = False
def exit(self, exit_status=0):
self.log.debug("Exiting application: %s" % self.name)
diff --git a/contrib/python/traitlets/py3/traitlets/config/tests/test_application.py b/contrib/python/traitlets/py3/traitlets/config/tests/test_application.py
index 860d1be2c9..db743f9f2e 100644
--- a/contrib/python/traitlets/py3/traitlets/config/tests/test_application.py
+++ b/contrib/python/traitlets/py3/traitlets/config/tests/test_application.py
@@ -805,6 +805,50 @@ def test_logging_config(tmp_path, capsys):
assert capsys.readouterr().err == "[Application] WARNING | warn\n"
+@pytest.fixture
+def caplogconfig(monkeypatch):
+ """Capture logging config events for DictConfigurator objects.
+
+ This suppresses the event (so the configuration doesn't happen).
+
+ Returns a list of (args, kwargs).
+ """
+ calls = []
+
+ def _configure(*args, **kwargs):
+ nonlocal calls
+ calls.append((args, kwargs))
+
+ monkeypatch.setattr(
+ "logging.config.DictConfigurator.configure",
+ _configure,
+ )
+
+ return calls
+
+
+def test_logging_teardown_on_error(capsys, caplogconfig):
+ """Ensure we don't try to open logs in order to close them (See #722).
+
+ If you try to configure logging handlers whilst Python is shutting down
+ you may get traceback.
+ """
+ # create and destroy an app (without configuring logging)
+ # (ensure that the logs were not configured)
+ app = Application()
+ del app
+ assert len(caplogconfig) == 0 # logging was not configured
+ out, err = capsys.readouterr()
+ assert "Traceback" not in err
+
+ # ensure that the logs would have been configured otherwise
+ # (to prevent this test from yielding false-negatives)
+ app = Application()
+ app._logging_configured = True # make it look like logging was configured
+ del app
+ assert len(caplogconfig) == 1 # logging was configured
+
+
if __name__ == "__main__":
# for test_help_output:
MyApp.launch_instance()