GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-109373: Store metadata required for pystats comparison in the json by mdboom · Pull Request #109374 · python/cpython

Conversation

@mdboom

@mdboom mdboom commented Sep 13, 2023 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Issue: pystats should save all metadata necessary to perform comparison in pystats .json output #109373

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mdboom
pythongh-109373: Store metadata required for pystats comparison in th…
db0687f
…e json
@bedevere-app bedevere-app Bot added the awaiting review label Sep 13, 2023
@mdboom
mdboom requested a review from markshannon September 13, 2023 14:24
@bedevere-app bedevere-app Bot mentioned this pull request Sep 13, 2023
pystats should save all metadata necessary to perform comparison in pystats .json output #109373
Closed
@mdboom mdboom added skip issue skip news and removed skip issue labels Sep 13, 2023
brandtbucher
brandtbucher approved these changes Sep 14, 2023
View reviewed changes

@brandtbucher brandtbucher left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks good, just one suggestion to maybe improve the funny ratio_to_float function. It's minor, though, so I'll merge tomorrow regardless.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Tools/scripts/summarize_stats.py Outdated
Comment on lines +30 to +38
def ratio_to_float(s):
"""
The inverse of format_ratio.
"""
if s == "":
return 0.0
else:
return float(s[:-1])

@brandtbucher brandtbucher Sep 14, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This confused me, because it's not the inverse, right? It just turns "4.2%" into 4.2 (which feels wrong to me since I'd expect .042... I know that this is what the old code does, and it's only used as a sort key, so I guess either is fine).

So I'd suggest changing the name and docstring, but I honestly can't think of a good name for this operation...

At least, if this is gonna be its own function, maybe assert s.endswith("%") so it's clear what this function is doing?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mdboom mdboom Sep 15, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good point. I renamed the function and clarified in the docstring.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Tools/scripts/summarize_stats.py
stats[key] += value
stats['__nfiles__'] += 1

import opcode

@brandtbucher brandtbucher Sep 14, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Just curious, why was this import moved here? Just to reduce the temptation to use it elsewhere in the file?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mdboom mdboom Sep 15, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yes, exactly. Any use of opcode, dis or other sorts of bytecode introspection things on the "compare two results" path could lead to a subtle, silent error. I'll add a comment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Sep 14, 2023
mdboom added 2 commits September 14, 2023 19:15
@mdboom
Clarify percentage to float
6bcd7c6
@mdboom
Document not importing opcode, dis, etc.
6ebb320
@mdboom
mdboom requested a review from brandtbucher September 15, 2023 13:44
@brandtbucher
brandtbucher merged commit 19f5eff into python:main Sep 15, 2023
@bedevere-app bedevere-app Bot removed the awaiting core review label Sep 15, 2023
csm10495 pushed a commit to csm10495/cpython that referenced this pull request Sep 28, 2023
@mdboom @csm10495
pythonGH-109373: Store metadata required for pystats comparison in th…
287a3fa
…e JSON (pythonGH-109374)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon Awaiting requested review from markshannon
@brandtbucher brandtbucher Awaiting requested review from brandtbucher

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@mdboom @brandtbucher
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.