Skip to content

bpo-37961: tracemalloc: store the actual length of traceback #15545

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

Merged
merged 2 commits into from
Oct 15, 2019

Conversation

jd
Copy link
Contributor

@jd jd commented Aug 27, 2019

bpo-37961: tracemalloc: store the actual length of traceback

This adds a new field to the traceback_t data structure so it stores the
original length of the traceback that was recorded. This is useful to know if
the traceback has been truncated or not.

https://bugs.python.org/issue37961

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also update Doc/library/tracemalloc.rst documentation, document Trace.length new attribute (I suggest to add Traceback.total_nframe attribute instead):
https://docs.python.org/dev/library/tracemalloc.html#trace

Is it possible to load a pickle file created by Python 3.7 on Python 3.9 with this change?

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@jd
Copy link
Contributor Author

jd commented Aug 30, 2019

Is it possible to load a pickle file created by Python 3.7 on Python 3.9 with this change?

No, it failed with:

>>> s.traces[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jd/Source/cpython/Lib/tracemalloc.py", line 299, in __repr__
    % (self.domain, _format_size(self.size, False), self.traceback))
  File "/Users/jd/Source/cpython/Lib/tracemalloc.py", line 284, in traceback
    return Traceback(self._trace[2], self._trace[3])
IndexError: tuple index out of range

I fixed it by setting a default nframe to None if the info is not available.

@jd jd force-pushed the tracemalloc-nframes branch from 52a90f3 to cd7f84e Compare August 30, 2019 13:41
@jd
Copy link
Contributor Author

jd commented Aug 30, 2019

@vstinner I just saw your comment on the issue. I'll update this to also reduce the size of the already existing nframe attribute.

@jd jd force-pushed the tracemalloc-nframes branch from cd7f84e to 403780f Compare September 2, 2019 11:49
@jd jd force-pushed the tracemalloc-nframes branch 2 times, most recently from 653a8e2 to 455e165 Compare September 9, 2019 14:24
@jd
Copy link
Contributor Author

jd commented Sep 25, 2019

That should be ready for review but I see @bedevere-bot might be confused with labels. Ping @vstinner?

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In C, you chose "total_nframe" name. In Python, it's "nframe" in the API, and sometimes "length" in the code. I would prefer to always use the same name everywhere.

I like "total_nframe", but I don't have a strong preference :-)

@jd jd force-pushed the tracemalloc-nframes branch from 455e165 to ac946ae Compare October 7, 2019 15:28
@jd
Copy link
Contributor Author

jd commented Oct 7, 2019

@vstinner Updated with your comments :)

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the updated PR looks better. Another round of minor comments.

You may mention total_nfrace in start() documentation: https://docs.python.org/dev/library/tracemalloc.html#tracemalloc.start Users may want to use it to adjust the next call to start().

@jd jd force-pushed the tracemalloc-nframes branch from ac946ae to f593044 Compare October 8, 2019 08:58
@jd
Copy link
Contributor Author

jd commented Oct 8, 2019

Here you go @vstinner :)

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall change now LGTM, but I have one suggestion about the tracemalloc.Traceback constructor which may simplify the code and leaves the API kind of backward compatible.

@jd jd force-pushed the tracemalloc-nframes branch from f593044 to 1c78fe8 Compare October 14, 2019 08:05
@jd
Copy link
Contributor Author

jd commented Oct 14, 2019

Last update I hope 🤞 @vstinner :)

@vstinner
Copy link
Member

That means you lose information when you load traces from Python <= 3.8 as there's no way to know if the total_nframe was captured or simply faked at load time. I think it's better to say that you either that information or you don't (so set to None) rather than trying to make the field ambiguous.

I'm not sure that I understand your comment. Do you suggest to modify your PR to allow total_nframe to be None? I think that I'm fine with that.

_group_by() and loading a Python 3.8 file would use total_nframe=None if I understand correctly. In that case, I suggest to modify Traceback.repr() to omit "total_nframe=%s" if it's None.

By the way, "<Traceback %r total_nframe=%s>" may be better to first show the most important first (the frames). So "<Traceback %r total_nframe=%s>" or "<Traceback %r>" depending if total_nframe is None.


In your implementation, total_nframe is lost in tracemalloc.get_object_traceback(). I'm not sure if it's a deliberate choice or not. Maybe tracemalloc_get_traceback() should be modified to read a trace instead, and _tracemalloc__get_object_traceback() should use trace_to_pyobject() rather than traceback_to_pyobject(). But other functions using tracemalloc_get_traceback() should still return only the traceback.

If you want, I can write this complex change, once this PR lands.

@jd
Copy link
Contributor Author

jd commented Oct 14, 2019

I'm not sure that I understand your comment. Do you suggest to modify your PR to allow total_nframe to be None? I think that I'm fine with that.

You were suggesting to always set total_nframe to some value — either the one provided in the argument list, or, if set to None, to compute it with len(frames). I'm just saying that doing so would make None an invalid value for total_nframe which removes a piece of information that might be important. :)

_group_by() and loading a Python 3.8 file would use total_nframe=None if I understand correctly. In that case, I suggest to modify Traceback.repr() to omit "total_nframe=%s" if it's None.
By the way, "<Traceback %r total_nframe=%s>" may be better to first show the most important first (the frames). So "<Traceback %r total_nframe=%s>" or "<Traceback %r>" depending if total_nframe is None.

Why not, done.

In your implementation, total_nframe is lost in tracemalloc.get_object_traceback(). I'm not sure if it's a deliberate choice or not.

No, it's not. It's just a "feature not implemented yet". :)

If you want, I can write this complex change, once this PR lands.

Yeah, I think it'd be safer to go in a new PR that leverage this one rather than making this one heavier. 👍

@jd jd force-pushed the tracemalloc-nframes branch from 1c78fe8 to 7e30a3a Compare October 14, 2019 10:14
@vstinner
Copy link
Member

You were suggesting to always set total_nframe to some value — either the one provided in the argument list, or, if set to None, to compute it with len(frames).

In your PR, total_nframe is always set to an integer. When you don't know the value, you put len(frames), but you do that in the Traceback caller. I suggest to do that in the constructor to simplify your PR: tests, get_object_traceback(), _group_by(), etc. would just call Traceback(frames).

I'm just saying that doing so would make None an invalid value for total_nframe which removes a piece of information that might be important. :)

Again, your PR always set total_nframe to a number, so I don't understand your remark. Do you plan to modify your PR to set total_nframe to None in some cases (ex: _group_by())? If yes, you should update the documentation to mention that total_nframe can be None.

@jd jd force-pushed the tracemalloc-nframes branch from 7e30a3a to 7e4af49 Compare October 14, 2019 13:10
@jd
Copy link
Contributor Author

jd commented Oct 14, 2019

In your PR, total_nframe is always set to an integer. When you don't know the value, you put len(frames), but you do that in the Traceback caller. I suggest to do that in the constructor to simplify your PR: tests, get_object_traceback(), _group_by(), etc. would just call Traceback(frames).

That's mainly because the argument was mandatory in an earlier version IIRC. I can just remove it from the tests now if you prefer.

Again, your PR always set total_nframe to a number, so I don't understand your remark. Do you plan to modify your PR to set total_nframe to None in some cases (ex: _group_by())? If yes, you should update the documentation to mention that total_nframe can be None.

The initial plan was to always have it set to the number of frames — remember, it was named nframes. So it would either be the number of frames we captured or — if available — the number of total frames that were originally in place. So None was not possible value.

Now, the way the PR has changed, None could be a value. I've updated the PR in that sense. Some tests now uses None has a value. I've updated the attribute doc.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial plan was to always have it set to the number of frames — remember, it was named nframes. So it would either be the number of frames we captured or — if available — the number of total frames that were originally in place. So None was not possible value.
Now, the way the PR has changed, None could be a value. I've updated the PR in that sense. Some tests now uses None has a value. I've updated the attribute doc.

Oh, I see, the PR evolved and then was longer consistent. I'm fine with having total_nframe=None. It's just that it wasn't clear if it could be None or not. It's better with your update PR.

New review.

@jd jd force-pushed the tracemalloc-nframes branch from 7e4af49 to c3c24ed Compare October 14, 2019 14:21
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. But the CI blocks the PR.

jd added 2 commits October 15, 2019 10:14
This adds a new field to the traceback_t data structure so it stores the
original length of the traceback that was recorded. This is useful to know if
the traceback has been truncated or not.
@jd jd force-pushed the tracemalloc-nframes branch from c3c24ed to dc54ec0 Compare October 15, 2019 08:14
@jd
Copy link
Contributor Author

jd commented Oct 15, 2019

Thanks, fixed the doc!

@vstinner vstinner merged commit 8d59eb1 into python:master Oct 15, 2019
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot x86 Gentoo Installed with X 3.x has failed when building commit 8d59eb1.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/103/builds/3247) and take a look at the build logs.
  4. Check if the failure is related to this commit (8d59eb1) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/103/builds/3247

Failed tests:

  • test_asyncio

Failed subtests:

  • test_start_tls_server_1 - test.test_asyncio.test_sslproto.SelectorStartTLSTests

Summary of the results of the build (if available):

== Tests result: FAILURE then FAILURE ==

406 tests OK.

1 test failed:
test_asyncio

12 tests skipped:
test_asdl_parser test_check_c_globals test_clinic test_devpoll
test_gdb test_kqueue test_msilib test_startfile test_winconsoleio
test_winreg test_winsound test_zipfile64

1 re-run test:
test_asyncio

Total duration: 25 min 54 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/test_sslproto.py", line 585, in test_start_tls_server_1
    self.loop.run_until_complete(run_main())
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/base_events.py", line 632, in run_until_complete
    raise RuntimeError('Event loop stopped before Future completed.')
RuntimeError: Event loop stopped before Future completed.


Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/threading.py", line 944, in _bootstrap_inner
    self.run()
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 192, in run
    self._test._abort_socket_test(ex)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 114, in _abort_socket_test
    self.fail(ex)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/unittest/case.py", line 736, in fail
    raise self.failureException(msg)
AssertionError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2560)
/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/threading.py:946: ResourceWarning: unclosed <ssl.SSLSocket fd=7, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 41812), raddr=('127.0.0.1', 32835)>
  self._invoke_excepthook(self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
ERROR


Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/base_events.py", line 1758, in call_exception_handler
    self._exception_handler(self, context)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 22, in loop_exception_handler
    self.loop.default_exception_handler(context)
AttributeError: 'NoneType' object has no attribute 'default_exception_handler'
/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/test_streams.py:40: ResourceWarning: unclosed <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 32835)>
  gc.collect()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
k


Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/sslproto.py", line 685, in _process_write_backlog
    self._transport.write(chunk)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/selector_events.py", line 904, in write
    self._fatal_error(exc, 'Fatal write error on socket transport')
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/selector_events.py", line 699, in _fatal_error
    self._force_close(exc)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/selector_events.py", line 711, in _force_close
    self._loop.call_soon(self._call_connection_lost, exc)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/base_events.py", line 738, in call_soon
    self._check_closed()
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/base_events.py", line 506, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed


Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/threading.py", line 944, in _bootstrap_inner
    self.run()
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 192, in run
    self._test._abort_socket_test(ex)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 114, in _abort_socket_test
    self.fail(ex)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/unittest/case.py", line 736, in fail
ERROR


Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 190, in run
    self._prog(TestSocketWrapper(self._sock))
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/test_sslproto.py", line 575, in <lambda>
    with self.tcp_client(lambda sock: client(sock, addr),
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/test_sslproto.py", line 520, in client
    answer = sock.recv_all(len(ANSWER))
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 130, in recv_all
    data = self.recv(n - len(buf))
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/ssl.py", line 1226, in recv
    return self.read(buflen)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/ssl.py", line 1101, in read
    return self._sslobj.read(len)
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2560)


Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/base_events.py", line 1758, in call_exception_handler
    self._exception_handler(self, context)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 22, in loop_exception_handler
    self.loop.default_exception_handler(context)
AttributeError: 'NoneType' object has no attribute 'default_exception_handler'
/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/test_streams.py:40: ResourceWarning: unclosed <socket.socket fd=8, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 32835)>
  gc.collect()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/selector_events.py:684: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=8>
  _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/sslproto.py:321: ResourceWarning: unclosed transport <asyncio.sslproto._SSLProtocolTransport object at 0xb5228c28>
  _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Unhandled error in exception handler
context: {'message': 'Fatal error on SSL transport', 'exception': RuntimeError('Event loop is closed'), 'transport': <_SelectorSocketTransport closing fd=8>, 'protocol': <asyncio.sslproto.SSLProtocol object at 0xb5712a60>}
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/selector_events.py", line 898, in write
    n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor


Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/test_sslproto.py", line 577, in run_main
    await asyncio.wait_for(
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 173, in __exit__
    self.stop()
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 166, in stop
    self.join()
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/threading.py", line 1020, in join
    raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread
Unhandled error in exception handler
context: {'message': 'Task was destroyed but it is pending!', 'task': <Task pending name='Task-1750' coro=<BaseStartTLS.test_start_tls_server_1.<locals>.main() done, defined at /buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/test_sslproto.py:549> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0xb6a77dd8>()]> cb=[_release_waiter(<Future pendi...xb6a77220>()]>)() at /buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/tasks.py:429]>}
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/base_events.py", line 1758, in call_exception_handler
    self._exception_handler(self, context)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/test/test_asyncio/functional.py", line 22, in loop_exception_handler
    self.loop.default_exception_handler(context)
AttributeError: 'NoneType' object has no attribute 'default_exception_handler'
Warning -- Unraisable exception
Exception ignored in: <function _SelectorTransport.__del__ at 0xb6fa3a48>
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/selector_events.py", line 684, in __del__
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/warnings.py", line 112, in _showwarnmsg
    _showwarnmsg_impl(msg)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/warnings.py", line 28, in _showwarnmsg_impl
    text = _formatwarnmsg(msg)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/warnings.py", line 128, in _formatwarnmsg
    return _formatwarnmsg_impl(msg)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/warnings.py", line 64, in _formatwarnmsg_impl
    tracing = tracemalloc.is_tracing()
AttributeError: partially initialized module 'tracemalloc' has no attribute 'is_tracing' (most likely due to a circular import)
Warning -- Unraisable exception
Exception ignored in: <function _SSLProtocolTransport.__del__ at 0xb7052100>
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/asyncio/sslproto.py", line 321, in __del__
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/warnings.py", line 112, in _showwarnmsg
    _showwarnmsg_impl(msg)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/warnings.py", line 28, in _showwarnmsg_impl
    text = _formatwarnmsg(msg)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/warnings.py", line 128, in _formatwarnmsg
    return _formatwarnmsg_impl(msg)
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/warnings.py", line 64, in _formatwarnmsg_impl
    tracing = tracemalloc.is_tracing()
AttributeError: partially initialized module 'tracemalloc' has no attribute 'is_tracing' (most likely due to a circular import)
/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.9/threading.py:946: ResourceWarning: unclosed <ssl.SSLSocket fd=7, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 55722), raddr=('127.0.0.1', 35395)>
  self._invoke_excepthook(self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
k

@vstinner
Copy link
Member

jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
Add a total_nframe field to the traces collected by the tracemalloc module.
This field indicates the original number of frames before it was truncated.
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
Add a total_nframe field to the traces collected by the tracemalloc module.
This field indicates the original number of frames before it was truncated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants