Skip to content

Commit

Permalink
Merge pull request #69 from mgedmin/py311
Browse files Browse the repository at this point in the history
Add support for Python 3.11
  • Loading branch information
mgedmin committed Nov 28, 2022
2 parents 46b7699 + 719be2b commit d38f14c
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Expand Up @@ -25,6 +25,7 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- "3.11"

steps:
- name: Install OS dependencies
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Expand Up @@ -6,7 +6,7 @@ Changes
3.5.1 (unreleased)
------------------

- Add support for Python 3.9 and 3.10.
- Add support for Python 3.9, 3.10, and 3.11.

- Drop support for Python 3.6.

Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Expand Up @@ -9,6 +9,7 @@ environment:
- PYTHON: "C:\\Python38"
- PYTHON: "C:\\Python39"
- PYTHON: "C:\\Python310"
- PYTHON: "C:\\Python311"

init:
- "echo %PYTHON%"
Expand Down
2 changes: 1 addition & 1 deletion docs/generator-sample.txt
Expand Up @@ -43,7 +43,7 @@ Or we can examine just one of the reference chains leading straight to a module.
>>> objgraph.show_chain(
... objgraph.find_backref_chain(objgraph.by_type('Canary')[0],
... objgraph.is_proper_module),
... filename='canary-chain.png')
... filename='canary-chain.png') # doctest: +NODES_VARY
Graph written to ....dot (11 nodes)
Image generated as canary-chain.png

Expand Down
2 changes: 1 addition & 1 deletion docs/highlighting.txt
Expand Up @@ -16,7 +16,7 @@ You can highlight some graph nodes.
>>> objgraph.show_backrefs(a, max_depth=15,
... extra_ignore=[id(locals())],
... highlight=lambda x: isinstance(x, Node),
... filename='highlight.png')
... filename='highlight.png') # doctest: +NODES_VARY
Graph written to ....dot (12 nodes)
Image generated as highlight.png

Expand Down
2 changes: 1 addition & 1 deletion docs/index.txt
Expand Up @@ -111,7 +111,7 @@ you've any examples where that isn't true, I'd love to hear about them
... objgraph.find_backref_chain(
... random.choice(objgraph.by_type('MyBigFatObject')),
... objgraph.is_proper_module),
... filename='chain.png')
... filename='chain.png') # doctest: +NODES_VARY
Graph written to ...dot (13 nodes)
Image generated as chain.png

Expand Down
2 changes: 1 addition & 1 deletion objgraph.py
Expand Up @@ -3,7 +3,7 @@
You can find documentation online at https://mg.pov.lt/objgraph/
Copyright (c) 2008-2017 Marius Gedminas <marius@pov.lt> and contributors
Copyright (c) 2008-2022 Marius Gedminas <marius@pov.lt> and contributors
Released under the MIT licence.
"""
Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -81,6 +81,7 @@ def build_images(doctests=()):
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
keywords='object graph visualization graphviz garbage collection',
py_modules=['objgraph'],
Expand Down
21 changes: 18 additions & 3 deletions tests.py
Expand Up @@ -378,14 +378,13 @@ def doctest_get_new_ids_prints():
>>> _ = objgraph.get_new_ids(limit=0)
>>> _ = objgraph.get_new_ids(limit=0)
>>> a = [0, 1, 2] # noqa
>>> b = [3, 4, 5] # noqa
>>> a = [[] for n in range(10)] # noqa
>>> _ = objgraph.get_new_ids(limit=1)
... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
========================================================
Type Old_ids Current_ids New_ids Count_Deltas
========================================================
list ... ... ... +2
list ... ... ... +11
========================================================
"""
Expand Down Expand Up @@ -504,6 +503,17 @@ def a_method(self):

self.assertEqual('a_method', objgraph._short_repr(MyClass.a_method))

def test_short_repr_frame(self):
frame = sys._getframe()
# we're calling _short_repr() 6 lines down from here
lineno = frame.f_lineno + 6
# Python >= 3.9 uses absolute filenames
expected = {
'tests.py:%d' % lineno,
'%s:%d' % (os.path.abspath('tests.py'), lineno),
}
self.assertIn(objgraph._short_repr(frame), expected)

def test_gradient_empty(self):
self.assertEqual((0.1, 0.2, 0.3),
objgraph._gradient((0.1, 0.2, 0.3),
Expand All @@ -514,6 +524,11 @@ def test_edge_label_frame_locals(self):
self.assertEqual(' [label="f_locals",weight=10]',
objgraph._edge_label(frame, frame.f_locals))

def test_edge_label_frame_globals(self):
frame = sys._getframe()
self.assertEqual(' [label="f_globals",weight=10]',
objgraph._edge_label(frame, frame.f_globals))

@skipIf(sys.version_info[0] > 2, "Python 3 has no unbound methods")
def test_edge_label_unbound_method(self):
class MyClass(object):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py37, py38, py39, py310
envlist = py27, py37, py38, py39, py310, py311

[testenv]
deps =
Expand Down

0 comments on commit d38f14c

Please sign in to comment.