Fix #120140: RNA: Support single quote in path_resolve
#120141
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#120141
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChengduLittleA/blender:fix-120140"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Support single quote in path_resolve so usages like
bpy.data.path_resolve("objects['Cube']")
can work withrepr()
sinceit returns paths with single quoted key.
@ -1480,0 +1505,4 @@
else {
EXPECT_EQ(BLI_str_escape_find_quote_with(item.text, item.quote_character),
item.text + item.expect_offset);
}
What's the reason to write this like this (with a large percentage of the conditional code duplicated), instead of something like:
In case of test failure, it would be good to know which exact case failed. Something like this I think would help:
@ -1480,0 +1513,4 @@
TEST_F(StringEscapeFindQuote, Simple)
{
/* NOTE: clang-tidy `modernize-raw-string-literal` is disabled as it causes errors with MSVC.
* TODO: investigate resolving with `/Zc:preprocessor` flag. */
This comment raises lots of questions. How is this disabled? Because I don't see any change in this PR that disables it. And what errors does it cause? Would this be solved by switching the
const char *
to aStringRef
/StringRefNull
/std::string
?I have no idea what this part is... I copied something from above 😅... I think it's safe to just remove the comment.
@ -143,3 +143,3 @@
/* Copy string, taking into account escaped ']' */
if (quoted) {
if (quote_character) {
BLI_str_unescape(buf, *path, len);
This code relies on
BLI_str_unescape()
doing the right thing, but from reading the code of that function I get the feeling that it doesn't take single quotes into account. This will only come into play when a name has both a single quote and a double quote in there, as only having a single quote will not need escaping:I feel that asking you to change that too is out of scope for this PR (as that would, IMO, also need another unit test, in an area that doesn't have any unit tests at all yet). So just take this as a notice you can scoop aside and ignore at your leasure ;-)
Indeed. This is something I didn't catch, which is expected XD since all the legacy string functions are inter-related. I'll see what I can do with the
BLI_str_unescape()
part, probably trivial.Thanks for the PR! I think it's 99% there, just a few questions.
LGTM, but since this is so core, I'd love some extra eyes on this. @ideasman42 would you want to review this too?
It's late here, I don't have time for full review but have found problems with this patch, there are places where single quotes isn't implemented it's not clear where they are / aren't supposed to be working. Note that not supporting single quotes was an intentional decision, so this isn't really a bug to fix, more a design decision.
Replied to #120140 (comment) which notes issues caused by this PR.
Checkout
From your project repository, check out a new branch and test the changes.