Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
satella
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
satella
Commits
0b6135b3
Commit
0b6135b3
authored
1 year ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
JSONEncoder will behave correctly on weird classes (no __slots and no __dict__)
parent
418e6328
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
satella/__init__.py
+1
-1
1 addition, 1 deletion
satella/__init__.py
satella/json.py
+1
-1
1 addition, 1 deletion
satella/json.py
with
3 additions
and
2 deletions
CHANGELOG.md
+
1
−
0
View file @
0b6135b3
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
*
added safe_listdir
*
added safe_listdir
*
fixed a bug occurring in Python 3.10 with whereis
*
fixed a bug occurring in Python 3.10 with whereis
*
DirectorySource will raise an exception if directory does not exist and on_fail is set to RAISE
*
DirectorySource will raise an exception if directory does not exist and on_fail is set to RAISE
*
JSONEncoder will behave correctly on weird classes (no __slots and no __dict__)
Build system
Build system
============
============
...
...
This diff is collapsed.
Click to expand it.
satella/__init__.py
+
1
−
1
View file @
0b6135b3
__version__
=
'
2.25.0a
3
'
__version__
=
'
2.25.0a
4
'
This diff is collapsed.
Click to expand it.
satella/json.py
+
1
−
1
View file @
0b6135b3
...
@@ -46,13 +46,13 @@ class JSONEncoder(json.JSONEncoder):
...
@@ -46,13 +46,13 @@ class JSONEncoder(json.JSONEncoder):
try
:
try
:
for
k
,
v
in
o
.
__dict__
.
items
():
for
k
,
v
in
o
.
__dict__
.
items
():
dct
[
k
]
=
self
.
default
(
v
)
dct
[
k
]
=
self
.
default
(
v
)
v
=
dct
except
AttributeError
:
# o has no attribute '__dict__', try with slots
except
AttributeError
:
# o has no attribute '__dict__', try with slots
try
:
try
:
for
slot
in
o
.
__slots__
:
for
slot
in
o
.
__slots__
:
dct
[
slot
]
=
self
.
default
(
getattr
(
o
,
slot
))
dct
[
slot
]
=
self
.
default
(
getattr
(
o
,
slot
))
except
AttributeError
:
# it doesn't have __slots__ either?
except
AttributeError
:
# it doesn't have __slots__ either?
v
=
'
<an instance of %s>
'
%
(
o
.
__class__
.
__name__
,)
v
=
'
<an instance of %s>
'
%
(
o
.
__class__
.
__name__
,)
v
=
dct
return
v
return
v
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment