Repository navigation
Require a decimal point for fractional seconds - #1280
Conversation
The datetime, time, and timedelta converters treated any character as the fractional separator and did not require the rest of the value to match. 23:06:20X511581 came back as a time with 511581 microseconds. An illegal value is supposed to come back as the original string.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe datetime, timedelta, and time patterns now require a literal period before fractional seconds. Their converters require the full input to match, with existing fallback behavior retained. Tests cover inputs that use ChangesDatetime and time conversion
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Malformed separators and partial temporal strings remain unconverted, while valid fractional values retain coverage; no actionable merge-blocking risk is evident. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change tightens temporal parsing without adding privileges, dependencies, or new data access. Malformed values may now remain strings rather than become temporal objects, consistent with the existing invalid-input behavior. No material security risk was identified in the affected conversion path. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1280 +/- ##
==========================================
- Coverage 86.24% 85.15% -1.10%
==========================================
Files 17 17
Lines 2436 2486 +50
Branches 258 253 -5
==========================================
+ Hits 2101 2117 +16
- Misses 249 301 +52
+ Partials 86 68 -18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
convert_time("23:06:20X511581")returnedtime(23, 6, 20, 511581). The fractional pattern used an unescaped dot, soXwas read as the separator and511581as microseconds.convert_datetime("2007-02-24 23:06:20X511581")andconvert_timedelta("25:06:17X511581")did the same. The match also did not have to consume the rest of the value, so escaping the dot alone still returned a time of the prefix.23:06:20.511581is stilltime(23, 6, 20, 511581).2007-02-24 23:06:20is still that datetime.-25:06:17.1is still the same timedelta. The doctests say an illegal value comes back as the original string.Test plan
python -m unittest pymysql.tests.test_converters(12 tests, ok).doctest.testmod(pymysql.converters)was 13 passed.Summary by CodeRabbit